0

I am using this flag in manifest.xml to have only one instance of the activity.

android:launchMode="singleInstance"

But if this activity say A launches a new activity say B and then pressing back button on B not showing activity A. It is showing activity from where we launched A.

Basically i want to create a activity if it is not in stack and if in stack bring on the top. But back button should also work properly.

What flag i should use for this.

2
  • Make noHIstory flag in manifest for activities which you dont want to see. Commented Dec 20, 2015 at 7:41
  • 1
    android:launchMode="singleTask" Commented Dec 20, 2015 at 7:56

2 Answers 2

1

use android:launchMode="singleTask" instead of android:launchMode="singleInstance"

Sign up to request clarification or add additional context in comments.

Comments

0

following code activityA(parent activity),then A launch activity b. Declare these lines in manifest.xml file. When click back button it goes to previous activity(i.e A(parent)).

<activity android:name=".ActivityB" android:label="@string/app_name" android:parentActivityName=".ActivityA" android:windowSoftInputMode="adjustPan" > <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.prathap.ActivityA" /> </activity> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.