Practice T Flashcards

1
Q

Is this legal XML (Imagine the <>s)

LinearLayout Button / Button /Button /LinearLayout

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the return type of the function findViewBydId(int id)

A

View

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If you declare an XML tag <androidx.appcompat.widget.Toolbar>, is this the normal android libraries or the AppCompat libraries?</androidx.appcompat.widget.Toolbar>

A

AppCompat libraries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T/F - If you are using the normal Android libraries, you can call setSupportActionBar() to load a toolbar

A

False.

setSupportActionBar did not exist pre-androidx. You would use setActionBar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What function would you call to set the view of a Dialog box?

A

setView

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

For a Checkbox or switch widget, what function do you call to listen for when the user clicks on it?

A

setOnCheckedChangedListener

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the default orientation of LinearLayout?

A

Horizontal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What function do you call on the adapter to redraw the reyclerView when data has been added or removed?

A

notifyDatasetChanged()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What should the function getView(int, position, View old, ViewGroup parent) use to load a view?

A

LayoutInflater

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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?

A

Different: getUpgrade()

Same: Nothing will get called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What function do you call to start an AyncTask?

A

execute()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you go to another Activity using startActivity(), does onActivityReult() get called when the next activity terminates?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you create a subclass of AsyncTask<String, Integer, Double>, what is the parameter type of the doInBackground(??) function?

A

String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

AsyncTask<Params, Progress, Result>

How do these 3 sections relate to doInBackground() ?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What do you call on a recyclerView to listen for users selecting something from the list?

A

setOnItemClickListener()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What function causes a recyclerView to draw items? (First time)

A

setAdapter()

17
Q

Which of these is not a type of Fragment Transaction?

delete

add

replace

remove

A

delete

18
Q

If we set MenuItem to ShowAsAction=”always”, what parameter gets used?

A

icon

19
Q

What does the insert function return?

A

The id of the row where the record was inserted

20
Q

T/F - You can open a connection to a web server on the GUI thread

A

False

21
Q

If a JSON object has the attribute “value”:24.5, what function would you call to retrieve the data?

A

getDouble(“value”);

22
Q

If there is a tag: <-car brand=”ford” /->, what function do you call to read what brand is written in the tag?

A

getAttributeValue(null, “brand”)

23
Q

What does the update() function return?

A

The number of rows updated

24
Q

If you see the message “Unfortunately IainsAndroidLabs stopped” where do you look for more info?

A

LogCat tab

25
Q

IF you click on an item in the NavigationView, what function gets called?

A

onNavigationItemSelected

26
Q

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?

A

null

27
Q

What function do you call to stop an Activity, and go to the previous Activity

A

finish()

28
Q

What function do you call to run a fragment transaction?

A

commit()