I have three actions - AB and C, of which B is the Tab tab . First, action A starts, and B starts from A. I end operation A when B starts using this code.
public void onStop() {
super.onStop();
this.finish();
}
Now I want to start Activity C when the back key is pressed in B.
I tried overriding the key with this code
@Override
public void onBackPressed() { this.getParent().onBackPressed();
}
This does not help when the parent activity ends when the child process starts. What actually happens when I press the back key is that the action goes to the main screen.
I tried to override the return key and set the intent for it
@Override
public void onBackPressed() {
Intent backIntent = new Intent();
backIntent.setClass(this, main.class);
startActivity(backIntent);
}
That doesn't help either. What could be a possible solution to this problem? How to start Activity C when I press the back key?