I have an application with three activities. FirstActivity, SecondActivity, ThirdActivity.
In FirstActivity there is a button, which starts SecondActivity. In SecondActivity, there are two ways to go to the ThirdActivity. But there is one method with a code:
Intent intent = new Intent(SecondActivity.this, ThirdActivity.class);
finish();
startActivity(intent);
Both variants use this code snippet.
- This code runs in a +- 12 seconds automatically
- In
onBackPressed()
method
And here is my problem: when user press Back, ThirdActivity opens, but in a few seconds ThirdActivity opens again from the first variant.
So, how to fully kill an Activity, so it won't start another activity for two times?