Application Components Flashcards

1
Q

Define what an Activity is…

A

A UI window within the application that users can interact with. Each activity is a subclass of the Activity class ( AppCompatActivity )

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

Define what a Task is…

A

A Task is a set of related Activities that can span across a single of multiple applications.

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

What is the Task Back Stack?

A

The mechanism within a Task that manages the Activities within the Task.

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

What in the Stack will the resumed activity be?

A

At the top of the stack.

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

For activities that aren’t at the top of the stack, what state are they in?

A

A suspended state such as paused or stopped.

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

When are activities removed from the stack?

A

When they’re destroyed.

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

Give a real example of the back stack in usage…

A

If a user is in an email app viewing their listed emails page (Activity A), and they open an email (Activity B), then Activity B will be added to the top of the back stack, on top of Activity A. Then when the email is closed, Activity B will be removed from the back stack, and Activity A will be top of the stack again.

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

What are the 3 Activity Lifecycle states? (4th if by the book)

A

(Non-existant)
Stopped
Paused
Resumed

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

Define each of the Activity Lifecycle states…

A

Non-existant -> Activity is not instantiated and is not allocated memory.
Stopped -> Instantiated and allocated memory, but not visible.
Paused -> Activity is allocated memory, and is partly visible.
Resumed -> Activity is visible and can be interacted with. Only one activity can be in this state at any given time.

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

What are the 7 lifecycle callback methods?

A

onCreate() -> Brings activity into memory.
onStart() -> Becomes visible and persistent data is loaded.
onResume() -> Activity moves foreground to be interacted with.
onPause() -> Moves out of foreground.
onStop() -> Caches current state, still allocated space but not visible or interacted with.
onDestroy() -> Removed from memory.
onRestart() -> Called when stopped and about to restart.

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

What is a lifecycle callback? What is their purpose?

A

A method that the OS calls at certain stages throughout the Activity or Fragments lifecycle.
They enable management and manipulation of the application as it activities transition through different stages.

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

What is meant by context in Android development?

A

Context can be considered as an interface to the global information about the application. It acts as a handle to the environment that your application is currently running in, enabling access to system services, preferences, databases etc.

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

Explain the process that happens when an explicit intent is used?

A

The intent is sent to the Activity Manager in the Android OS. The AM then instantiates the destination activity, and sends the intent to this activity along with the associated data.

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

In what 2 formats can putExtra() store data associated to an intent?

A
  • Key-Value records where the receiving intent can use the Key to extract the associated value.
  • Bundle object, the associated data can be stored in a Bundle object which is added to the intent. The receiving activity can extract the data from the bundle.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When a user clicks on the application in the launcher, what is actually opening?

A

The launcher activity for that application is opening. This is defined using an intent filter in the applications manifest.

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

Define a Service…

A

A long running, background process. For example, Reminders or Clock.

17
Q

Define the Broadcast Receiver component…

A

A component that can register for specific broadcasts. It can then listen and respond to these broadcasts.

18
Q

Define the Content Provider component…

A

A component that interfaces an apps data storage. It controls the way in which other apps can interact with the apps data storage.