Android‎ > ‎

Sleep Android(Resume Activity)

posted Jun 19, 2012, 7:51 AM by Akash Khaitan   [ updated Mar 9, 2013, 7:55 AM ]

Problem : Activity restarts when resumed from sleep state

Sleep
occurs when pressing the power button, the screen light is switched off and pressing it again, brings us to the lock screen
.

Reason
This happens particularly for activities that are locked in rotation
android:screenOrientation="landscape"


Solution
Just add an extra line (configchanges) as shown below
In the Manifest file

<activity

   
android:name=".Activity"
   
android:screenOrientation="landscape"
   
android:configChanges="orientation"
/>

Comments