-2

I have a PreferenceActivity that has a Preference on it. When the preference launches an activity using startActivity, the PreferenceActivity is stopped and removed by the OS.

I would like the user to return to the original PreferenceActivity instead of having it be finished and removed by the operating system.

The OS is removing the activity but I cannot tell why. HOw can I tell where/which code is calling finish on my activity?

@Override
protected void onClick() {
    // TODO Auto-generated method stub
    super.onClick();

    log("click");

    Intent sintent = new Intent(context, MusicPrefActivity.class);
    context.startActivity(sintent);

}

    <activity
        android:name=".ui.prefs.RokuPrefActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>


    <activity
        android:name=".ui.prefs.MusicPrefActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>
Milk Run
  • 17
  • 8
  • It's quite unusual for an `Activity` to be terminated immediately after it starts another `Activity` unless resources on the device are extremely low. Normally the first `Activity` will go into a 'stopped' state but the way Android works means that there is little or no guarantee as to when it will terminate any part of any app. – Squonk Aug 20 '12 at 21:30
  • Squonk - I agree -- its not so much that it is being destroyed, its that it is removed from the activity stack that is surprising. normally when the user hits back, the activity would be re-instantiated. The behavior reminds me of setting nohistory in the Manifest. I checked and I don't have it set. – Milk Run Aug 20 '12 at 21:38

1 Answers1

0

I'm an idiot -1 to me. I was setting NO_HISTORY flag on intent I knew it was a history issue, I should have posted code and it would have been obvious.

Milk Run
  • 17
  • 8