This is my second activity,
@Override
public void onBackPressed() {
super.onBackPressed();
try {
object.put_stats(getApplicationContext());
}
} catch (JSONException | IOException e) {
e.printStackTrace();
}
this.finish();
overridePendingTransition(R.anim.slideouttoright, R.anim.slideinfromleft);
}
But when I'm pressing the back button I'm getting directed to the home screen. This is where I call the 2nd activity from,
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivityForResult(intent, 1);
overridePendingTransition(R.anim.slideinfromright, R.anim.slideouttoleft);
I want to go to the last activity from the 2nd activity upon pressing back button. I don't want to start a new activity by starting an intent.