Android_Development_Solutions
Android_Development_Solutions
An Adapter acts as a bridge between the data source (e.g., an array, database, or list) and a UI
component like a ListView or RecyclerView. It helps populate the UI with data dynamically.
The MenuInflater class is used to create and instantiate menu items from XML menu resource files
A common multimedia element is the VideoView or MediaPlayer, used to play audio or video files.
The onStop() method is invoked when an activity is no longer visible to the user.
Permissions in the AndroidManifest file are used to inform the system about the app's required
Example:
<uses-permission android:name="android.permission.INTERNET"/>
Q2b. Components of the Android Activity lifecycle:
- onResume(): Called when the activity starts interacting with the user.
- Table View: Used to organize data into rows and columns with fixed layouts. It is less interactive.
- Grid View: Displays items in a scrollable grid, often used for interactive apps like photo galleries.
A Content Provider in Android is a component that manages access to a central repository of data. It
Key Features:
1. Data Sharing: Enables one app to access data stored by another app.
2. Uniform Interface: Provides a standard set of methods to perform data operations (CRUD).
3. URI Structure: Each Content Provider exposes its data through a unique URI.
CRUD Operations:
Example:
while (cursor.moveToNext()) {
String name =
cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
1. Internal Storage: Stores private data within the app's private directory.
2. External Storage: Used for storing large files like images, videos, and documents.
4. SharedPreferences: Stores small key-value pairs, typically used for user preferences or settings.
5. Cloud Storage: Uses cloud services (e.g., Firebase) to store and synchronize data across
devices.
2. Context Menu: Displays a menu for a specific UI element, usually on a long press.
popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
popup.setOnMenuItemClickListener(item -> {
return true;
});
popup.show();