1/111
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Is the Android API the same across all versions of Android?
No.
Is Android open or closed source?
Open.
What do Android applications run on top of?
The Android API which is meshed with the System API.
What is part of the Android Open Source Project (AOSP) as opposed to brand-specific functionalities?
Android Framework, Generic Kernel, and Generic Kernel Image (GKI) Modules.
What is the hierarchy of the Android Platform architecture?
System Apps
Java API Framework
Native C/C++ Libraries, Android Runtime
Hardware Abstraction Layer (HAL)
Linux Kernel
What is the hierarchy of layers in the Android Application architecture?
UI Layer: Displays application data for user to interact with.
Domain Layer: Optional layer to encapsulate business logic.
Data Layer: Application data and business logic.
What is LiveData
Data like Strings, Lists, etc. that need to be observable (update automatically like in JavaFX).
What is business logic?
It refers to what is done behind the scenes with state changes.
In easier terms, it is the logic that glues your models together.
How is Android Application architecture generally set up?
According to the MVVM design pattern.
M: Model (Data logic)
V: View (Activity, Fragment)
VM: ViewModel (Business logic [LiveData])
Do Android devices run .class and .jar files?
No. They run Android runtime which is optimized for performance.
Is Kotlin is interoperable with Java?
Yes.
What is an Android Virtual Device (AVD)?
An emulator to model an actual Android device.
Can you simulate games or location in AVD?
Not with the same speed or consistency.
What is the Android project structure?
manifests directory: App settings.
source directory: Controllers.
res directory: drawable (images), layout (views), mipmap (icons), values (constants) directories.
Gradle Scripts: Application configuration and dependency management (build.gradle).
What languages can be used to build Android apps?
Kotlin, Java, C++.
What is an Android Package (APK)?
An archive file of your code. Basically a JAR file for Android devices.
Does Android function as a single user Linux system?
No, it is multi user Linux system. Each application is a different user. Each application is assigned a unique Linux user ID.
How many Linux processes are run per application?
One. Each process has its own virtual machine (VM).
What's the difference between desktop and mobile application processes?
Mobile applications automatically shut down other application processes when memory is low.
By default, does each Android application have access ONLY to the Components that it requires to do its work?
Yes.
Do Android applications directly control their application process' lifetime?
No. The Android system handles this.
Is it possible to arrange for two applications to share the same Linux user ID?
Yes. This allows one application to access the other application's data.
What are the essential building blocks of an Android application?
Components.
What are the four types of Components?
1. Activities (UIs)
2. Services
3. Broadcast receivers
4. Content providers (sources of data)
Do all Components share the same lifecycle?
No.
What is the difference between how applications are started on desktop versus mobile?
Mobile applications don't always begin in the same place. Sharing a PDF via email on mobile goes directly to a "compose email" activity and loads the PDF, for example.
Does Android initiate code in main()?
No. Android applications can be started through Activities or other components.
What does an Activity do?
It provides the window in which the app draws its UI.
Are you good to run your application after simply adding an Activity?
No. You must register your Activity in the manifest file.
How does the Android Activity lifecycle work?
Example:
You open an app: onCreate() → onStart() → onResume()
You get a call: onPause() → onStop()
You return to the app: onRestart() → onStart() → onResume()
You swipe away the app: onPause() → onStop() → onDestroy()

What is the back stack?
A stack of Activities in order of when it was opened.
What happens to the last Activity when a new Activity starts?
The last activity is stopped and placed in the back stack.
What happens when the user completes the current Activity and presses the back button?
The current Activity is popped from the back stack and destroyed. The previous Activity is then resumed.
What are lifecycle callback methods?
onCreate(), onResume(), onDestroy(), etc. in your Activity class.
Where do you declare how your Activity behaves when the user leaves or enters the Activity?
In the lifecycle callback methods.
When is the onCreate() callback method called?
When an Activity is created.
You should fill it with logic like initializing class-scope variables that exist during the duration of the Activity.
Is the onCreate() callback method optional?
No. You need to define what happens upon Activity startup.
How does the onCreate() callback method receive previously saved states?
Through the Bundle savedInstanceState parameter.
onCreate(Bundle savedInstanceState)
When is the onStart() callback method called?
Immediately after the onCreate() callback method.
It runs the code to display the UI.
When is the onResume() callback method called?
Immediately after the onStart() or onPause() callback method, depending on whether the application was just created or is just being resumed.
You should fill it with logic like initializing Components released during the onPause() callback method.
When is the onPause() callback method called?
When the Activity is no longer in the foreground (e.g. the application is swiped away).
You should fill it with logic like pausing operations that would waste battery life (e.g. pause location tracking).
When is the onStop() callback method called?
When the Activity is no longer visible to the user (e.g. a new Activity covers the entire screen).
You should fill it with logic like pausing operations that would waste battery life (e.g. pause location tracking).
When is the onDestroy() callback method called?
When the Activity is about to exit.
You should fill it with logic like releasing all resources not yet released by previous callback methods.
What are Services?
Services provide long-running operations in the background without displaying a UI (e.g. playing sounds or network connectivity).
What are Broadcasts?
System messages like battery low, alarm, screen turned off, etc.
What are Broadcast Receivers?
A component that lets the system deliver events (like a battery low notification) to the app, even ones that are not running).
What happens when Activities, Services, and Broadcast Receivers are not implemented correctly?
The system can kill the application's process while it is doing important work.
What are the two ways applications receive broadcasts?
1. Receivers declared in the manifest file.
2. Receivers registered in the Context.
What are Content Providers?
A component that manages a set of app data so it can be stored in a storage location.
How do you start new Activities?
startActivity()
OR
startActivityForResult() (when a result needs to be passed back)
Regardless of which is chosen, and Intent object is passed.
Do Activities overlap when starting and stopping?
Yes.
Example:
Activity A => onPause()
Activity B => onCreate() => onStart() => onResume()
Activity A => onStop()
What is an Intent?
An object specifying what to do with a Component.
What is the difference between Intents for Activities, Services, and Broadcast Receivers?
Activities and Services: The Intent defines the action to perform (like ACTION_SEND).
Broadcast Receivers: The Intent defines the announcement being broadcast.
Since Android applications are separate processes associated with different user IDs, how does an application activate Components in other applications?
Using Intent objects.
What is the passive data structure holding an abstract description of an action to be performed?
An Intent.
What are the fundamental use cases for Intents?
Starting an Activity, Service, or delivering a Broadcast.
Do Intents for Activities represent a single screen or multiple screens?
A single screen.
What do you do if you need information back from an Activity?
Use the startActivityForResult() method instead of the startActivity() method.
What is the difference between an explicit and implicit Intent?
Explicit: Specifies which Component satisfies the Intent.
Implicit: Specifies the action, data, and category from which the Android system will determine which Component satisfies the Intent.
You can think of an implicit Intent as giving some information to the Android system which consequently chooses the best Component to match the information.
What is an Intent filter?
For example, an EmailInboxActivity Component should be specified to be a potential candidate for incoming email Intents.
What is the primary information contained in an Intent?
Name of Component: Class name (EmailService, EmailActivity, etc.).
Action: A String specifying the action to perform (ACTION_VIEW, ACTION_SEND, etc.).
Data: The URI referencing the data.
Category: A String specifying the category of the Intent (CATEGORY_EMAIL, CATEGORY_LAUNCHER, etc.)
Extra: Key-value pairs for additional information.
What is the extra portion of an Intent?
Data to share between Activities. Specifically, a Bundle object is shared between two Activities.
What kind of data types can you share between Intents in the extra portion?
Primitive data types like ints.
Objects like String.
How do you pass data using the extra portion of an Intent?
Activity 1:
public static final String key = "message";
intent.putExtra(key, bundle);
startActivity(intent);
Activity 2:
Intent intent = getIntent();,
int bundle = intent.getIntExtra(Activity1.key, 0);
OR
String bundle = intent.getStringExtra(Activity1.key);
OR
Thing bundle = (Thing) intent.getSerializableExtra(Activity1.key);
OR
Thing bundle = (Thing) intent.getParcelableExtra(Activity1.key);
How do you start a Component using an explicit Intent?
Intent explicitIntent = new Intent(this, SomeService.class);
explicitIntent.setData(Uri.parse(fileUrl));
startService(expicitIntent);
How do you start a Component using an implicit Intent?
Intent implicitIntent = new Intent();
implicitIntent.setAction(Intent.ACTION_SEND);
implicitIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
What is a Context?
A Singleton class linked to the Application which holds all Activities running inside it. It has access to system resources and services as well as to application operations like starting Activities, broadcasting and receiving Intents, etc.
For example, context.startActivity(intent) is completely valid syntax.
What is the manifest file?
An XML file that primarily informs the Android system about Components' existence. It is important to specify Components here, otherwise the application won't use them.
It also declares permissions required, features needed (like Bluetooth or multi-touch), and APIs used.
How are Components specified in the manifest file?
(specify
For the other Components,
What are application resources?
Resources separate from the source code like images, audio files, etc.
What is the benefit of application resources?
It makes it easy to update various features of your application without modifying source code.
What is a resource ID?
An ID that corresponds to a resource (like an image).
You can access this ID by using R.id.imagename in Java.
What is a View?
Similar to a Node in JavaFX, a View is an element in the UI that the user can see and sometimes interact with.
What is a ViewGroup (layout)?
Similar to a Pane in JavaFX, a ViewGroup is a container that defines the layout structure for Views and other ViewGroup objects.
Do you have to use XML to describe the application layout?
No. You can instantiate ViewGroups and Views in the Java source code.
Why should you use XML for describing the UI over instantiating ViewGroups and Views in the Java source code?
It separates presentation and styling from code, as well as makes dynamic adaptation to differing screen sizes easier.
How many root elements can there be in a layout?
Exactly one View or ViewGroup object.
Where should the XML view files be loaded from?
The onCreate() callback method.
setContentView(R.layout.main.fxml);
What are two basic attributes of Views?
1. Location (x-y coordinate pairs)
2. Dimensions (width and height)
What unit is used for location and dimensions?
Density-independent pixel (dp).
What is Toast?
A simple non-clickable popup notification.
Context context = getApplicationContext();
Toast toast = Toast.makeText(context, "Hello World", Toast.LENGTH.SHORT);
toast.show();
What is AlertDialog?
A popup message that displays on the screen, where various dialog option choices to answer can be added.
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setMessage("Hello World").setTitle("Title");
AlertDialog dialog = alert.create();
dialog.show();
What are some common ViewGroup subclasses?
ConstraintLayout: Allows you to constrain Views to a vertical and horizontal offset from other Views or the side of the Layout.
LinearLayout (horizontal and vertical): Basically a JavaFX VBox/HBox.
FrameLayout: Basically a JavaFX StackPane.
TableLayout: Basically a JavaFX GridPane.
TableRow: Individual row objects in TableLayout.
Space: Empty container used to create space.
What is Logcat?
The Logcat window displays system messages (like when garbage collection occurs) and messages that you add to your application with the Log class.
What are the Log methods?
Log.e(String, String): Error log.
Log.w(String, String): Warning log.
Log.i(String, String): Information log.
Log.d(String, String): Debug log.
Log.v(String, String): Verbose log.
What is a Bundle?
A class that, when instantiated, can store a collection of data stored as key-value pairs. These can be given to an Intent so that a new Activity has the data. This way, a Singleton is unnecessary to hold data.
What shape do all Views have?
A rectangular area on the screen.
What is the prefix for stylizing Views?
"android:"
Example:
What is the difference between XML layout_height/layout_width values "match_parent" and "wrap_content"?
match_parent: As big as its parent View.
wrap_content: Just big enough to enclose its content.
Example:
android:layout_height="wrap_content"
What is a TextView?
Similar to a Label in JavaFX, a TextView is a View that displays text.
What is an EditText?
Similar to a TextField in JavaFX, an EditText is a View that allows a user to enter text.
Useful attributes:
android:inputType="text/phone/number/datetime/numericPassword"
How do you access application resources from /res in Java source code?
R.id
R.layout
R.drawable
R.array
R.string
R.color
R.style
What common Views in Android Studio have identical names to Nodes in JavaFX?
Button
RadioButton (which uses RadioGroup, not ToggleGroup)
CheckBox (which uses isChecked(), not isSelected()
ImageView
ListView
What ImageView attribute is used to get an image resource from /res/drawable?
"src"
XML:
android:src="@drawable/nameofimage"
Java:
imageView.setImageResource(R.drawable.cola);
What is the Adapter class?
An Adapter object accesses data in an array or other data type and creates a View for it.
What is the ArrayAdapter class?
One of the implementations to get data and provide a View for it.
How does an ArrayAdapter object create a View to be displayed to a user?
By default, it just calls Object.toString() on each element in the array, placing it in a TextView.
What common Views use an ArrayAdapter or other Adapter object?
Subclasses of AdapterView, namely:
Spinner
ListView
RecycleView also uses adapters.
Example:
view.setAdapter(adapter);
What is the Spinner class?
Similar to a ComboBox in JavaFX, a Spinner is a View that displays items and allows a user to choose an item.
You should use an ArrayAdapter to display items.
What is the ListView class?
Similar to a ListView in JavaFX, a ListView displays a collection of vertically scrollable Views.