Search code examples
androidandroid-activitycallbacklifecycle

Handle Activity life cycle while calling on different phones


can any body tell me what will happen if application is in running state,if some one will call over your phone,then which call back method will be called up.

i have tested on different real android devices and also emulator. 1. samsung (sdous,grand):- call onpause method,but after approx. 10 second it will call onstop method. 2. xiaomi(redmi):- call onpause method,but after few milliseconds(0.6 second approx),it will call onstop method. 3. sony (xperiz d2005):- call onpause method,but after 1 second approx,it will call onstop method. 4. emulator:-call onpause method,but after few milliseconds(0.6 second approx),it will call onstop method.

please tell me whats going on in this case.thanks in advance.


Solution

  • This behavior depends on free memory availability and handling strategy for different android version / device. Sometimes you can just have onPause, sometimes you'll get onDestroy and complete process termination (losing all you static variables, background processes, loaders, etc) and later Activity restoration with onCreate(savedInstanceState != null).