Practice T Flashcards
Is this legal XML (Imagine the <>s)
LinearLayout Button / Button /Button /LinearLayout
Yes
What is the return type of the function findViewBydId(int id)
View
If you declare an XML tag <androidx.appcompat.widget.Toolbar>, is this the normal android libraries or the AppCompat libraries?</androidx.appcompat.widget.Toolbar>
AppCompat libraries
T/F - If you are using the normal Android libraries, you can call setSupportActionBar() to load a toolbar
False.
setSupportActionBar did not exist pre-androidx. You would use setActionBar
What function would you call to set the view of a Dialog box?
setView
For a Checkbox or switch widget, what function do you call to listen for when the user clicks on it?
setOnCheckedChangedListener
What is the default orientation of LinearLayout?
Horizontal
What function do you call on the adapter to redraw the reyclerView when data has been added or removed?
notifyDatasetChanged()
What should the function getView(int, position, View old, ViewGroup parent) use to load a view?
LayoutInflater
if you call getWriteableDatabase() from an SQLiteOpenHelper object and the older version is 1.9 and the new version is 2, what function will get called? What if they’re the same version?
Different: getUpgrade()
Same: Nothing will get called
What function do you call to start an AyncTask?
execute()
If you go to another Activity using startActivity(), does onActivityReult() get called when the next activity terminates?
No
If you create a subclass of AsyncTask<String, Integer, Double>, what is the parameter type of the doInBackground(??) function?
String
AsyncTask<Params, Progress, Result>
How do these 3 sections relate to doInBackground() ?
Params - type of input parameters to pass to doInBackground
Progress - The type of values that represent progress updates
Result - the type returned as a result from doInBackground
What do you call on a recyclerView to listen for users selecting something from the list?
setOnItemClickListener()
What function causes a recyclerView to draw items? (First time)
setAdapter()
Which of these is not a type of Fragment Transaction?
delete
add
replace
remove
delete
If we set MenuItem to ShowAsAction=”always”, what parameter gets used?
icon
What does the insert function return?
The id of the row where the record was inserted
T/F - You can open a connection to a web server on the GUI thread
False
If a JSON object has the attribute “value”:24.5, what function would you call to retrieve the data?
getDouble(“value”);
If there is a tag: <-car brand=”ford” /->, what function do you call to read what brand is written in the tag?
getAttributeValue(null, “brand”)
What does the update() function return?
The number of rows updated
If you see the message “Unfortunately IainsAndroidLabs stopped” where do you look for more info?
LogCat tab
IF you click on an item in the NavigationView, what function gets called?
onNavigationItemSelected
These 2 lines of code are in the onCreate() function of an Activity whose layout is called saveLayout.xml
Button saveButton = (Button)findViewById(R.id.SaveButton);
setContentView(R.layout.saveLayout)
What is the value of the variable saveButton now?
null
What function do you call to stop an Activity, and go to the previous Activity
finish()
What function do you call to run a fragment transaction?
commit()