Question

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..!

Was it helpful?

Solution

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

OTHER TIPS

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

I validated it on the emulator by creating an incoming call on my emulator. To do this I used the emulator console and used the gsm call option.

The values in my textview are saved on resume.

Thanks a lot for ur replies!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top