Apps have led to the immense popularity of smartphones. Google play store has millions of apps about anything and everything. This has helped offshore android developers with a lot of opportunities to create, upload and market their own apps. Android SDK makes it easier for developers to build applications by using preset components offered by Google. The 4 main components that can be used are:
- Activity
- Services
- Content Providers
- Broadcast receivers
An activity essentially has four stages which are as follows:
- Active: As the name suggests, it refers to an activity that is running at the moment on the foreground.
- Paused: An activity is paused when it is still alive and yet partially covered by another activity on the foreground. Such an activity can be resumed by closing the front activity.
- Stopped: If an activity is completely covered by another activity, it is stopped and yet alive. User can resume it closing the front activity or else the system can close it to free resources when necessary.
- Destroyed: When an activity is paused or stopped by the user and is killed by the memory, it is in the destroyed state. After this stage an activity can only be resumed by restarting it.
The entire lifecycle of activity can be explained as:
- Activity launched –
- onCreate() – UI creation and initialization
- onStart() – Activity still not active
- onResume() – Activity is visible and running
- onPause() – Another activity is being called on top of this activity; all data must be saved as system might kill this
- activity in need of additional resources.
- onRestart() – If the activity is resumed by the user before being killed by the system
- onDestroy() – Activity is either killed by the system or the user for use at another time
No comments:
Post a Comment