1/41
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Activity
represents a single screen in the app where the user can perform a single focused task such as sending an e-mail. It is usually presented to the user as a full-screen window.
Activity
To implement an activity: 1. Create an __________ Java class.
XML layout
To implement an activity: 2. Implement a basic UI for the Activity in an associated ____ _________ file.
AndroidManifest
To implement an activity: 3. Declare the new Activity in ______________.xml
Main activity (MainActivity.java)
It is presented to the user when the app is launched.
Activities
Main activity (MainActivity.java) can then start other ___________ to perform different actions.
Activity life cycle
It is the set of states an activity can be in during its entire lifetime.
onCreate()
It is invoked when the app is launched for the first time. It happens only once for the entire life of the activity.
onStart()
It is invoked before the activity becomes visible to the user.
onResume() or onStop()
onStart() is followed by either: _____________ or ____________
onResume()
onStart() is followed by either: • ___________ – if the activity comes to the foreground
onStop()
onStart() is followed by either: • ___________ – if the activity becomes hidden
onResume()
It is invoked before the activity starts interacting with the user.
onPause()
It is invoked when the system is about to start resuming another activity.
onResume() or onStop()
onPause() is followed by either: ___________ or ___________
onResume()
onPause() is followed by either: • ____________ – if the activity returns to the background
onStop()
onPause() is followed by either: • __________ – if the activity becomes invisible to the user
onStop()
It is invoked when the activity is no longer visible to the user.
onRestart()
onStop() is followed by either: • __________ – if the activity is coming back to interact with the user
onDestroy()
onStop() is followed by either: • ___________ – if the activity is about to end
onDestroy()
It is invoked when: • the activity is finishing (due to the user completely dismissing the activity or due to finish() being called on the activity)
configuration change
onDestroy() is invoked when: • the system is temporarily destroying the activity due to a ___________ ________ (such as device rotation or multi-window mode)
onRestart()
It is invoked if the activity comes back after being stopped.
onStart()
onRestart() is always followed by ______________.
back stack
Each time a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack called the __________ __________.
Intent
An activity is started or activated with an ________.
Intent
It is an asynchronous message that is used in an activity to request an action from another activity, or from some other app component.
Start
An intent can be used to ________ one activity from another activity, and to pass data between activities.
Target activity
the activity that will receive the intent.
Intent data/object
contains a reference to the data you want the receiving activity to operate on.
Intent extras
carry information the receiving activity requires to accomplish the requested action (optional).
Intent flags
may instruct the Android system how to launch an Activity or how to treat it after it's launched (optional).
Target Activity, Intent Data/Object, Intent Extras, Intent Flags
Parts of an Intent: HINT: TA ID/O IE IF
Explicit intent
The target of the intent (the class name of the activity) is already identified.
Implicit intent
The target of the intent is not yet identified but there is a general action to perform.
action, category, and data type
Implicit intent also includes an ________, ____________, and _______ ______.
parentActivityName
This attribute indicates that the main activity is the parent of the second activity. Arrow
onClick
To add an intent after creating a new activity: 2. Add the android:________ attribute to the Button element that will be used to start another activity.
Method
To add an intent after creating a new activity: 3. Define the _________ that will be used to start another activity.
Explicit
The intent added is an _________ intent because the receiving activity is specified (Main2Activity).
Current
The this keyword represents the _______ activity
Toast
To verify if the intent works, add a _______ to Main2Activity.