Monday, February 15, 2016

Understanding Android Activity Life Cycle

Firstly, to start creating your android app you must be clear with almost all of the basics that it takes for any developer to develop an android app. The basics to create your android app includes JAVA Programming, Understanding of Object Oriented Programming (OOPs) concepts, XML files and a good memory to remember these. If you want to become a good android developer for yourself, then these are the minimum required skills to take off. You can visit Programming Simplified also.

Lets first start with the Android Activity. Activity according to me is a web page as in a website. You can see the page and can interact with it to do something. Similarly, in android term, Activity is an application component that helps the users to interact with it using a screen for doing something. Examples: Take a photo, Call someone, Read Email, View a Map, etc.

How does it work actually? There is a life cycle attached to each and every activity through which it responds to and works accordingly. Let's say, for an example, you want to run your own business. For being able to run it, you will first of all start from somewhere. Maybe it could be like collecting money first up or getting a loan from a bank, joining your family business and learning it. Here in android, the activity starts running the same as to above mentioned lines. It initializes all of its components by running its onCreate() method.



 Before the activity is shown to the user it passes to three methods onCreate(), onStart(), onResume(). After the completion of onStart() and onResume() method, the activity is seen by the user but he/she can interact with it after onResume() method. At onPause(), the activity becomes invisible and the user cannot interact with it because another activity is working in the foreground. Then comes onStop() method where the activity becomes hidden from the user and it goes in the background where the code cannot execute for it. Last is the onDestroy() method where the activity is destroyed or stopped by the user.

0 Comments:

Post a Comment