Android – Handling Runtime Changes
In this video, We see How to occur Runtime changes in Android? We have seen that every android device has a functionality to change the orientation of screen at runtime. So when the device changes its orientation the activity will be restarted by calling all its method again. On orientation changes first, the activity will be destroyed and again created.And when the Activity is destroyed system calls onPause(), onStop(), and onDestroy() method simultaneously. And now to create activity system calls onCreate(), onStop(), and onResume() simultaneously.
There are different options to handle the orientation changes:
1. Lock screen orientation
2. Prevent Activity to recreated
3. Save basic state
4. Save complex objects