In my main activity, i set this override method to improve my animation activity :
overridePendingTransition(R.anim.pull_in_from_right, R.anim.pull_out_to_left);
In my second activity, i set onBackPressed() method to the main activity :
public void onBackPressed()
{
Intent backToMain = new Intent(this, MainActivity.class);
startActivity(backToMain);
super.onBackPressed();
}
It go back well, with the animation, but when I close the main activity that back from the second activity, the first main activity launched, still exist.
How to resolve this problem ? Thanks for your kindness response.
In your second activity, you don’t have to create new intent to go back to main activity.
EDIT : After seeing OP’s comment