Agshin Huseynov Agshin Huseynov - 1 year ago 134
Android Question

How to detect when an Android app minimized?

How to detect when an Android app goes to the background? onPause() works but it also called when orientation changed.

Answer Source

If orientation changes the app will call through the life cycle once again that means from oncreate

you can avoid it as well by writing the following to code to the manifest

      android:label="@string/app_name" />

this tell the system that when orientation changes or keyboardHidden or screenLayout changes I will handle it by myself no need to re create it.

then write your code on on pause

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download