P
P
penexe2014-01-06 21:48:58
Android
penexe, 2014-01-06 21:48:58

How to jump through the activity when clicking on the up, back button?

Activity chain A > B > C > D
B D pressed "back", should return not to C, but to B

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanKiLL, 2014-01-07
@penexe

When adding an activity, AndroidManifest.xmlset a flag . android:noHistory="true"
For example LoginActivity, then the activity will not be present in the history chain.

<activity
  android:name="ru.habrahabr.toster.LoginActivity"
  android:label="@string/title_activity_login"
  android:noHistory="true"
  android:screenOrientation="portrait"
  android:theme="@android:style/Theme.NoTitleBar" >
</activity>

O
Oleg Gamega, 2014-01-06
@gadfi

@Override
    public void onBackPressed() {
        Intent  intent = new Intent(this, B.class);
        startActivity(intent);
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question