• MANISH GAUTAM

Android activity and Activity life cycle ( ANDROID DEVELOPMENT )

Basics of android development technology for developers...



Android development is a process of creating and developing a new application in the Android operating system. The languages used in development are java, kotlin, etc and the android studio is a platform where we can write code and test it very easily.




Android activity: ▶ The activity is a change of state of the application experience by a user during navigation and activity returns a callback which allows efficient use of the application. When the user navigates through the application the activity will change

as create, destroy, running in the background all these processes follow the activity life cycle.





Android lifecycle: ▶ To navigate the transition between the change of activity state. The activity class provides a set of callbacks for better use of the application. The diagram is shown below is all about the activity lifecycle.




1️⃣ onCreate() :> In this method, you will create a basic activity that remains constant throughout the development. Basically whatever is seen when you open your application

for e.g, view and view group is only created by the onCreate() method.



2️⃣ onStart() :> When the application is in the started state then the system uses this callback to start the application for the first time and try to maintain better UI for the user which gives a better experience to the user.



3️⃣ onResume() :> After started state, the application remains in the resume state and it is the state where the user interacts with the application. The app remains in this state until something happens like the user receives a call, moving to another app, etc.



4️⃣ onPause() :> When the application is in the pause state it means our app is running in the background but not visible in the foreground. Generally, it is used when our app is interrupted during execution.



5️⃣ onStop() :> When the activity is no longer visible to the user, it has entered in a stopped state. Generally when the application is about to close then the system uses this callback to stop the app successfully.



6️⃣ onDestroy() :> This callback is used before the activity is destroyed. Generally, this callback is used when activity is finishing or the system is temporarily destroying the activity due to a configuration change.



So this is a short and easy explanation of activity and activity lifecycle in android development...