BSOD
BSOD

Reputation: 3

Close activity after perfoming

I have an Activity A, which starts activity B, which starts activity C. When I press back button I want go back to the Activity A. Instead, activity B is always opened (as a popup thanks to the style) after pressing back on activity C.

I try with meta-data following android doc but i can't solve my issue.

http://developer.android.com/training/implementing-navigation/ancestral.html

        <activity
            android:name="com.test.A"
            android:label="@string/ActivityA"
            android:screenOrientation="landscape" >
        </activity>
        <activity
            android:name="com.test.B"
            android:label="@string/ActivityB"
            android:theme="@android:style/Theme.Holo.Dialog" >
        </activity>
        <activity
            android:name="com.test.C"
            android:label="@string/ActivityC" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.test.A"/>
        </activity>

Upvotes: 0

Views: 74

Answers (3)

Chintan Soni
Chintan Soni

Reputation: 25267

try this way.

...
finish();
startActivity(new Intent(ActivityB.this, ActivityC.class));
...

Upvotes: 1

Tishka17
Tishka17

Reputation: 320

Finish activity B when starting activity C from it

Upvotes: 0

tim.paetz
tim.paetz

Reputation: 2761

After you start activity C from Activity B call finish(); It will remove B from the stack.

Upvotes: 0

Related Questions