delete callback history Android

1

I have an application which consists of 3 activities, A , B , C , I already have in onBackPressed of B and C return me to A :

 Intent intent = new Intent(this, MainActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);

However, in A I want to press the button back to take me out of the application, I do not want to be returned either% B or%% co_, I have the following code in C but it does not work

 finish();
            super.onBackPressed();

and I can not put the same as in the others the intent since to press back would be infinite in the activity onBackPressed

    
asked by Andress Blend 11.12.2017 в 21:08
source

1 answer

1

You can define your Actividad as singleTask in AndroidManifest.xml so that there is only a Activity A and do not create new activities according to your requirements.

<activity
    android:name=".ActividadA"
    android:launchMode="singleTask">
    
answered by 11.12.2017 / 21:37
source