Sunday, 18 August 2013

Persist activity not to go to MAIN

Persist activity not to go to MAIN

when I start activity with following code.
intent = new Intent(MainActivity.this, New1Activity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, StaticValue.REQUEST_CODE_MENU_01);
after New1Activity activity showed up, open another package app such as
Facebook app and then go back (by multitasking switch or back button) to
my app. In this scenario, I expected New1 activity will be given but
MainActivity is shown.
In addition, AndroidManifest.xml is as below.
<activity
android:name="mypackage.MainActivity"
android:screenOrientation="landscape"
android:launchMode="singleTop"
android:noHistory="true"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".New1Activity"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="landscape"
/>
I noted noHistory and singleTop to each activity because of my app
performance management.
How can I persist my activity status whenever I go back from other app?

No comments:

Post a Comment