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.