I am trying to end all of my android activities by called finish() under the onPause method. Now this was working fine until I noticed that the activity finished when I tilted the device (Galaxy tab). So I am assuming that the device pauses the activity and redraws it when tilted horizontally or vertically. This threw a major money wrench into my plan. So the question is, how do you finsih the activity on pause, but not for a system pause like tilting the device. Thanks guys.
Add android:configChanges="keyboardHidden|orientation" to your activity in manifest file. This will avoid re-creation of activity on orientation of the device changed. Overide onConfigurationChanged in your activity to handle orientation change manually if any changes need to be done.
<activity android:name=".ui.MyActivity" android:label="@string/home"
android:configChanges="keyboardHidden|orientation">
@Override
public void onConfigurationChanged(Configuration newConfig) {
handleViewlayouts();
super.onConfigurationChanged(newConfig);
}