Quiz 4-8 Flashcards
Which function do you call to find out where your application has been installed on the device?
getFilesDir()
Which function do you call if you want to display a message in the logcat window at the Debug level of importance?
Log.d(“message”);
must be capitalized, must have something in the parenthesis
If a SharedPreferences file has an int object stored under the name “Age”, what function would you call to retrieve the saved value? Just write the function name, the variable name, and assume a default value of 1, and also include the semicolon at the end.
getInt(“Age”, 1);
What <uses-feature> do you need to add to the AndroidManifest in order to use the camera? Copy and paste the entire line here:</uses-feature>
uses-feature android:name=”android.hardware.camera” android:required=”true” /
Sort these functions in order that they are called when starting an Activity.
____ onResume
____ onPause
____ onStop
____ onStart
____ onCreate
____ onDestroy
__3__ onResume
__4__ onPause
__5__ onStop
__2__ onStart
__1__ onCreate
__6__ onDestroy
The RecyclerView is not part of the normal Android widgets. What library do you have to add to the build.gradle file to add support for the Recycler View? Just write the name, not the :1.1.0 after. Also, don’t write the quotation marks.
androidx.recyclerview:recyclerview
What kind of Java object do you use to load a layout from an XML file when creating a ViewHolder? Just write the name of the class:
LayoutInflater
What is the name of the function where you set the strings for the TextViews, or EditTexts? In other words, one function is responsible for calling findViewById() to load the objects in Java, and the other function is responsible for setting the text. Which function would you call setText? Just write the name, not the ( ) parameter section.
OnBindViewHolder
What is the name of the programming pattern where you can call multiple function calls on the same object? An example would be:
object.function1()
.function2()
.function3()
.function4()
Builder Pattern
What function do you call to change the Text highlighted in the picture on an AlertDialog? Just write the name of the function that changes the text, not the parentheses ( ).
setTitle
What kind of object is used in a layout for saving space to load a Fragment? In other words, what kind of XML tag do you put in a layout to say where a Fragment will go?
FrameLayout
Which kind of Fragment Transaction is used for removing a Fragment from the screen?
remove
What is the layout folder name you should use for storing the layout for a 10” tablet?
layout-sw720dp
Write a line of code to add a Fragment whose variable name is listFragment, into a FrameLayout whose id is R.id.fragment_goes_here. You must write this using the builder pattern, where all function calls are called one after the other, with only one semicolon (;) at the end of the line. Do not put any spaces anywhere in your code:
getSupportFragmentManager().beginTransaction().add(-R.id.fragment_goes_here, listFragment).commit();
Which annotation do you put above the class that you want to store in a database?
@Entity