EXAM Flashcards

1
Q

What permission is needed to perform network operations?

A

android.permission.INTERNET

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

What are the 2 main advantages of the ViewModel class?

A
  1. Persist UI state
  2. Place for business logic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The lifecycle of a ViewModel is directly tied to its _______.

A

Scope

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

What method does the ViewModel call when it is destroyed?

A

onCleared()

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

LiveData is an _______ data holder class.

A

observable

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

LiveData is _______-aware, meaning it respects the ______ of things like activities, fragments, etc.

A

lifecycle

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

What is the data type we use for LiveData?

A

MutableLiveData< Data Type >

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

Which lifecycle method is the best place to begin observing LiveData?

A

onCreate()

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

How do you create an observer?

A

val observer= Observer< Data Type > { new -> view = new }
viewModel.current.observe(this, observer)

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

What permissions are needed for MyLocation functionality?

A
  1. ACCESS_COARSE_LOCATION
  2. ACCESS_FINE_LOCATION`
How well did you know this?
1
Not at all
2
3
4
5
Perfectly