1/54
Flashcards covering essential Android development concepts, components, and lifecycle management.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Android apps can be written using what languages?
Kotlin, Java, or C++
What is an APK (Android Package)?
An archive file with an .apk suffix containing all the contents of an Android app.
How does Android protect apps?
Each Android app lives in its own security sandbox, protected by Android security features.
How is Android's OS structured in relation to apps?
The Android OS is a multiuser Linux system where each app is a different user.
What is the app management principle implemented by the Android system for security?
The system implements the principle of least privilege, meaning each app has access only to the components it requires.
What are the four main types of app components in Android?
Activities, Services, Broadcast receivers, and Content providers
What class is a crucial component of an Android app?
The Activity class
How does the Android system initiate code in an Activity instance?
By invoking specific callback methods corresponding to a specific stage of its lifecycle.
What is the primary function of an Activity in Android?
An activity provides the window in which the app draws its UI.
How do you use activities in your app?
To register information about them in the app’s manifest and manage activity lifecycles appropriately.
Where does the system preserves the activity?
A stack (the "back stack").
What is a task in Android?
A collection of activities users interact with when performing a certain job.
What is the purpose of the onCreate() method in an Activity?
This callback fires when the system first creates the activity. You perform basic application startup logic here.
After the onCreate() method finishes execution, what state does the activity enter?
The activity enters the Started state, and the system calls the onStart() and onResume() methods in quick succession
What happens when the activity enters the Resumed state?
When the activity enters the Resumed state, it comes to the foreground, and the system invokes the onResume() callback. This is the state in which the app interacts with the user.
What is the purpose of the onPause() method?
The system calls this method as the first indication that the user is leaving your activity.
What happens when your activity is no longer visible to the user?
The system invokes the onStop() callback, and the app should release resources not needed while the app is not visible.
When is onDestroy() called?
onDestroy() is called before the activity is destroyed.
What is the primary function of a Service in Android?
A service performs long-running operations in the background without a UI.
How do you declare a service in Android?
To declare your service, add a
What is the purpose of Broadcast Receivers?
Send or receive broadcast messages from the Android system and other Android apps, similar to the publish-subscribe design pattern.
What is the purpose of Content Providers?
To manage access to data stored by itself or other apps and provide a way to share data securely.
Who or what controls an application process's lifetime in Android?
The application itself does not directly control an application process's lifetime; the system does.
How do you start a new activity in Android?
startActivity() or startActivityForResult(), passing in an Intent object.
How often will an app enter and exit an activity during its lifetime?
An app's likely to enter/exit activities many times during its lifetime.
What is the sequence of lifecycle callbacks when Activity A starts Activity B?
Activity A's onPause(), Activity B's onCreate(), onStart(), and onResume() in sequence, then Activity A's onStop() if no longer visible.
What is needed to activate a component in another app?
To activate a component in another app, deliver a message to the system that specifies your intent to start a particular component. Activities, services, and broadcast receivers are activated by an asynchronous message called an intent.
What does the Intent object specify?
An Intent object specifies the exact activity you want to start or describes the type of action you want to perform.
How does the documentation describe an Intent?
An Intent provides a facility for performing late runtime binding between different applications. It is a passive data structure holding an abstract description of an action to be performed.
What are the two types of Intents?
Explicit intents specify which application will satisfy the intent, using the target app's package or component class name. Implicit intents declare a general action, allowing other apps to handle it.
What is an intent filter?
An intent filter is an expression in an app's manifest file that is used to specify which types of intents that the component would like to receive.
What is the primary information contained in an Intent object?
Component name, Action, Data, Category, and Extra
Why advertise implicit intents your app can receive?
To advertise which implicit intents your app can receive.
What is Context in Android?
It is an Interface to global information about an application environment. It allows access to application-specific resources and classes
What is the primary task of the manifest file?
To inform the system about the app's components.
What elements are used to declare app components in the manifest file?
Why declare app requirements in the Manifest file?
To prevent your app from being installed on devices that lack features needed by your app.
What are App Resources?
Resources are separate from the source code, such as images, audio files, and anything relating to the visual presentation of the app.
What is the difference between a drawable resource and a layout resource?
A drawable resource is a general concept for a graphic that can be drawn to the screen. A layout resource defines the architecture for the UI in an Activity.
What comprises your app's user interface?
Everything the user can see and interact with.
How are all elements in a Layout built?
A hierarchy of View and ViewGroup objects.
What are the two ways you can declare a layout?
Declaring UI elements in XML or instantiating layout elements at runtime.
What are XML layout files compiled into?
XML layout files are compiled into a View resource.
Which method should be used to load the layout resource from your app code?
setContentView()
Name 5 common Android views.
textView, editText, Button, ScrollView and ImageView.
Define XML layout attributes.
Attributes which layout parameters for the View that are appropriate for the ViewGroup in which it resides.
Define ConstraintLayout.
ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy.
What layout parameter means as big as its parent (minus padding)?
match_constraint
What is the function of a toast?
A toast provides simple feedback about an operation in a small popup.
What method is used to instantiate a Toast object?
Toast.makeText()
What is displayed in the Logcat window in Android Studio?
The Logcat window in Android Studio displays system messages and messages that you added to your app with the Log class.
What is a Bundle and what is it used for?
A Bundle is a collection of data, stored as key/value pairs, used to pass information between activities.
What three identifiers do versions of Android have?
Versions of Android have a version number, API level, and code name.
What is an APK?
An APK is an Android application package, similar to a JAR file, containing your app’s bytecode, libraries, and resources.
Where to Android aps run?
Android apps run in separate processes using the Android runtime (ART).