Reputation: 3865
My app has two activities, ActivityA and ActivityB. They are specified in AndroidManifest below:
<activity android:name=".ActivityA" android:label="@string/app_name" android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ActivityB"
android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateAlwaysHidden"/>
The scenario of the problem is below.
I am very confused at step 5. What I expected is that, the app will be brought to foreground with its existing task stack, i.e. with only ActivityB in the task stack. Why does Android start ActivityA at step 5?
BTW, the client logs contains the message below at Step 5:
10-26 21:29:04.070 V/HtcAppUsageStats( 275): (launch app, package): (MyApp, com.example.myapp)
10-26 21:29:04.070 I/ActivityManager( 275): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x34500000 cmp=com.example.myapp/.ActivityA bnds=[0,566][540,662] (has extras) } from pid 275
Thanks for any suggestions!
Upvotes: 1
Views: 723
Reputation: 1919
Ok, so if you want to have an Activity not to show on long pressing home button:
Start that activity as intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);
In android Manifest for that activity android:excludeFromRecents="true"
You can follow this link as well This should solve your problem !!!
Upvotes: 0
Reputation: 3865
ahhhh, I saw this Android bug, http://code.google.com/p/android/issues/detail?id=26658. It seems to be the root cause.
Upvotes: 1