Short Questions Learning Android Application Main Building Blocks
Short Questions Learning Android Application Main Building Blocks
4. Why is it considered wasteful to discard an activity once the user leaves the
screen?
Discarding an activity upon user exit is wasteful because the operating system
invests resources in launching it, such as memory allocation and UI setup.
6. What are the callback methods invoked as an activity transitions from a starting
state to a running state?
The callback methods invoked are onCreate(), onStart(), and onResume().
7. What is the significance of the transition from the starting state to the running
state of an activity?
This transition is one of the most expensive operations in terms of computing
time, directly affecting the battery life of the device.
9. Why does the running activity have priority in terms of memory and resources
on Android?
Android prioritizes the running activity to ensure it runs quickly and remains
responsive to the user, enhancing the overall performance and user satisfaction.
14. Why is it recommended to do important work, like saving unsaved data, in the
onStop() rather than onDestroy() callback?
It's better to perform important work in the onStop() callback because a stopped
activity can also be destroyed, and there's no guarantee of destruction from the
destroyed state.
22. Why does the running activity receive priority in resource allocation on Android
devices?
The running activity receives priority in resource allocation to ensure it remains
responsive and efficient for the user, making it zippy and quick.
11.What are Android Activities, and how are they utilized in app development?
Android Activities are standalone modules representing UI screens and are
crucial for creating application functionality.
12. How do Android Fragments enhance app development?
Android Fragments provide an efficient alternative to representing UI screens,
allowing developers to break down activities into smaller sections.
13.What is the role of Intents in Android application flow?
Intents facilitate the launching of activities and define the flow through
different activities in an application.
14.What purpose do Broadcast Intents serve in the Android system?
Broadcast Intents are system-wide signals used to indicate system status
changes and events to all registered applications.
15. How do Broadcast Receivers function in Android, and why are they
important?
Broadcast Receivers respond to Broadcast Intents by executing predefined
actions and are crucial for asynchronous communication between components.
16. What are Android Services, and why are they valuable in app development?
Android Services are background processes without a user interface, ideal for
executing tasks that don't require UI visibility.
17. How do Content Providers facilitate data sharing between Android
applications?
Content Providers enable applications to share data by providing access to
underlying data sources such as databases or files.
18. What role does the Application Manifest file play in Android development?
The Application Manifest file outlines application components, permissions,
and data providers, serving as a crucial integration point for various app
elements.
19. How does Android utilize Application Context during runtime?
Android utilizes Application Context to access application resources and
modify the application's environment dynamically at runtime.
20. What is the significance of maximizing component reuse in Android
development?
Maximizing component reuse through activities, fragments, and intents
promotes code efficiency and accelerates app development while maintaining
consistency across applications.
1.What is the purpose of the Android Manifest file in Android app development?
Answer: The Android Manifest file serves as a blueprint that defines various aspects
of the app's behavior, requirements, and interactions with the Android operating
system and other applications.
2.What information does the Android Manifest file provide to the Android
operating system?
Answer: The Android Manifest file provides essential information such as the app's
package name, version code, version name, permissions, components, intent filters,
and configuration details to the Android operating system.
3.What are the primary components defined in the Android Manifest file?
Answer: The primary components defined in the Android Manifest file include
activities, services, broadcast receivers, and content providers
. 4.How are permissions declared in the Android Manifest file?
Answer: Permissions are declared using the element, where each permission
required by the app is specified with the android:name attribute.
5.What is the significance of intent filters in the Android Manifest file?
Answer: Intent filters specify the types of intents that components (activities,
services, broadcast receivers) can respond to, enabling interaction with other apps
and the system.
6.How are activities, services, broadcast receivers, and content providers declared
in the manifest?
Answer: Each component is declared with a corresponding XML element (, , , ) inside
the element, specifying attributes such as name, label, and intent filters.
7.What is the role of the package attribute in the element?
Answer: The package attribute in the element identifies the unique package name of
the app, which is essential for the Android system to manage and update the app.
8.How are app permissions specified in the Android Manifest file?
Answer: App permissions are specified using the element, where each permission
required by the app is declared with the android:name attribute
. 9.What does the versionCode attribute represent in the element?
Answer: The versionCode attribute in the element represents an integer value that
uniquely identifies different versions of the app.
10.How is the launcher activity defined in the Android Manifest file?
Answer: The launcher activity is defined within an element with an containing the
"MAIN" action and "LAUNCHER" category, indicating that it is the main entry point of
the app.
11.What is the purpose of intent filters in the Android Manifest file?
Answer: Intent filters specify the types of intents that components can respond to,
enabling interaction with other apps and the system.
12.How are app components activated by intents?
Answer: App components such as activities, services, and broadcast receivers are
activated by intents, which are messages defined by intent objects that describe
actions to perform.
13.What is the significance of file attributes in file management?
Answer: File attributes, such as read-only, hidden, system, or archive, control how a
file is treated by the operating system and user permissions, contributing to proper
file management.
14.How are permissions enforced in Android applications?
Answer: Android applications enforce permissions specified in the Android Manifest
file to protect user privacy and security, ensuring that apps only access resources or
interact with other apps as authorized. What is the role of metadata in file
organization and searchability? Answer: Metadata provides additional information
about a file, such as author, keywords, or description, facilitating file organization,
searchability, and classification.