Agshin Huseynov Agshin Huseynov - 11 months ago 109
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