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