I want to know that what will happen to my activity incase of an incoming phone call? Will the state of my activity be saved or I have to explicitly save it?
Another question is that will the activity resume after the call is disconnected?
Please help..!
The Activity lifecycle is especially important because whenever an activity leaves the screen, the activity can be destroyed. When an activity is destroyed, when the user returns to the activity, the activity will be re-created and the lifecycle methods will be called again.
finish(); at the end of activity. It will redirect you to your previous activity. Save this answer.
An activity provides the window in which the app draws its UI. This window typically fills the screen, but may be smaller than the screen and float on top of other windows. Generally, one activity implements one screen in an app.
You can test the behavior of your app through switching between portrait and landscape modus (CONTROL + F11 in the emulator). This will close your activity and then after the screen orientation is switched the activity is recreated.
Simple things will be saved, but some things like the position of your cursor, or user input to text fields won't be saved. You can do this yourself in the onSaveInstanceState() method from your Activity. Read more here
you can try that on the emulator by connecting another emulator and call the first one with it. Actually yes, your activity will be saved, and reload the phone call will stop. I'll try to find some doc for you. wait a few min plz
life cycle of an activity here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With