1/42
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Activity
This represent 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.
To implement an activity
Create an Activity Java class.
Implement a basic UI for the Activity in an associated XML layout file.
Declare the new Activity in AndroidManifest.xml.
Activity Life Cycle
This 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()
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.
onStop()
It is invoked when the activity is no longer visible to the user.
onDestroy()
t is invoked when:
the activity is finishing (due to the completely dismissing the activity or due to finish() being called on the activity)
the system is temporarily destroying the activity due to a configuration change (such as device rotation or multi-window mode)
onRestart()
It is invoked if the activity comes back after being stopped. It is always followed by onStart().
Back Stack
Each time a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack called “____“
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.
Parts of an intent
Target Activity
Intent data/object
Intent extras
Intent flags
Types of intent
Explicit Intent
Implicit Intent
Target Activity
The activity that will receive the intent.
Intent data/object
This contains a reference to the data you want the receiving activity to operate on.
Intent Extras
This carry information the receiving activity requires to accomplish the requested action (optional).
Intent flags
This may instruct the Android system how to launch an Activity or how to treat it after it’s launched (optional).
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. It also includes an action, category, and data type.
parentActivityName
This attribute indicates that the main activity is the parent of the second activity.
Layout
This define the structure for an app’s user interface.
View
This draws something the user can see and interact with.
ViewGroup
An invisible container that defines the layout structure for View and other ViewGroup objects.
Declare UI elements in XML
The presentation of the app can be separated from the code that controls its behavior.
Instantiate layout elements at runtime
The View and Viewgroup objects can be created and their properties can be manipulated programmatically.
Context
This is an interface to global information about an application environment.
wrap_content
This sets the size of the view to dimensions required by its content.
match_parent
This sets the view to be as big as its parent view group will allow.
Constraint Layout
This creates large and complex layouts with a flat view hierarchy (no nested view groups).
Linear Layout
This organizes its child view elements into a single horizontal or vertical row.
Relative Layout
This is used to specify the location of child objects relative to each other (child A to the left of child B) or to the parent (aligned to the top of the parent).
Web View
This is used for displaying web pages.
Frame Layout
This is designed to block out an area on the screen to display a single item.
Table Layout
This arranges its child objects into rows and columns.
Grid Layout
This arranges its child objects in a rectangular grid that can be scrolled.
Notification
This is a message that Android displays outside the app’s UI to provide the user with reminders, communication from other people, or other timely information from the app.
Notification Drawer
This allows to view more details and take actions with the notification.
App bar/action bar
This provides a visual structure and interactive elements that are familiar to users.
Toast
This provides simple feedback about an operation in a small popup.
Snackbar
This provides a quick pop-up message to the user.
Dialog
It is a small window that prompts the user to make a decision or enter additional information. It is not designed to fill the screen.
Menu
It is used to present user actions and other options in the app’s activities.