0% found this document useful (0 votes)
15 views3 pages

Short Questions Learning Android Application Main Building Blocks

An activity represents a single screen in an Android application. Activities are launched through an expensive process involving memory allocation and UI setup. The Activity Manager manages activities by creating, destroying, and transitioning them between states like running, paused, and stopped. Activities in the running state receive priority for resources to provide responsive user experiences.

Uploaded by

Najmi khan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Short Questions Learning Android Application Main Building Blocks

An activity represents a single screen in an Android application. Activities are launched through an expensive process involving memory allocation and UI setup. The Activity Manager manages activities by creating, destroying, and transitioning them between states like running, paused, and stopped. Activities in the running state receive priority for resources to provide responsive user experiences.

Uploaded by

Najmi khan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Short questions of Learning Android Application Main Building Blocks

1. What is an activity in the context of Android applications?


An activity in Android is typically a single screen that the user interacts with on
their device. Applications consist of multiple activities, allowing users to navigate
between different screens.

2. How does the concept of activities in Android relate to websites?


Activities in Android are analogous to pages on a website. Just as a website has
multiple pages, an Android application has multiple activities. The main activity of an
app is similar to a home page on a website, usually the first screen users see upon
launching the app.

3. What tasks are involved in launching an activity in Android?


Launching an activity involves creating a new Linux process, allocating memory for
UI objects, inflating objects from XML layouts, and setting up the screen.

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.

5. What role does the Activity Manager play in managing activities?


The Activity Manager, a service within the Android Framework layer, is responsible
for creating, destroying, and managing activities.

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.

8. What is the significance of an activity being in focus on an Android device?


When an activity is in focus, it means it's the one currently on the screen and
handling all user interactions, ensuring a seamless user experience.

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.

10. What is meant by an activity being in a paused state?


When an activity is visible on the screen but not interacting with the user, it is
considered to be in a paused state.

11. Why do activities typically go through a paused state?


Activities typically go through a paused state when something like a dialog box
appears in front of them, causing them to be paused en route to being stopped.

12. What does it mean when an activity is in a "destroyed" state?


A destroyed activity is no longer in memory; the Activity Manager has decided it is
no longer needed and removed it.

13. What actions can an activity perform before it is destroyed?


Before being destroyed, an activity can perform actions like saving any unsaved
information.

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.

15. What does the running state of an activity indicate?


The running state doesn't necessarily mean the activity is actively doing something;
it could be idle and waiting for user input.

16. What are intents in the context described?


Intents are messages that trigger activities, start or stop services, or facilitate
broadcasts among building blocks in an app.

17. What distinguishes an explicit intent from an implicit intent?


In an explicit intent, the sender specifies a particular component as the receiver,
while in an implicit intent, only the type of receiver is specified.

18. Can you provide an example of an implicit intent?


An example of an implicit intent could be sending a request to open a web page
without specifying a particular application to handle it.

19. What flexibility does this messaging system offer to users?


Users can replace any default app on the system with a custom one, such as
downloading a different SMS application or web browser to replace existing ones.

20. What determines which activity is in a running state on an Android device?


The activity currently on the screen and interacting with the user is in a running
state.

21. What does it mean when an activity is said to be in focus?


When an activity is in focus, it implies that all user interactions, such as typing and
touching the screen, are handled by this activity.

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.

23. What is meant by an activity being in a paused state?


When an activity is not interacting with the user but remains visible on the screen,
it is considered to be in a paused state..

24. How can a stopped activity be brought back to the foreground?


A stopped activity can be brought back to the foreground to become a running
activity again.

25. What determines whether a stopped activity is removed from memory?


The removal of stopped activities from memory is at the discretion of the Activity
Manager.

You might also like