An android application
does not have a main() method. The class android.Activity contains all the life-cycle methods for an android application. The android application life-cycle
methods contained in the android.Activity are called at appropriate times when
an android application is started, suspended, restarted, closed, etc. Android
applications run in their own Unix process and, hence, cannot affect other
running applications, directly.
Running android
applications can be in one of the following three states, at one time:
1. Active: The application
is running and visible to the user.
2. Paused: The application
is running but does not have the focus i.e. partly obscured.
3. Stopped: The
application is running but is completely hidden from view.
Android Application Life-cycle Methods:
An android application is transitioned
among above listed states by Android calling the below listed methods on the
current Activity at the appropriate times:
void
onCreate(Bundle savedInstanceState)
void
onStart()
void
onResume()
void
onRestart()
void
onPause()
void
onStop()
void
onDestroy()
onCreate() method is the
first activity of any android application. This is the most important method in
the lifecycle of an android application. This method acts like a constructor in
an android application. Here we normally do our constructor like work. In fact
onCreate() is the method that even the simplest of android application would
need.
No comments:
Post a Comment