Hello!
As the saying goes:
"Repetition is the mother of learning!"
For the hundredth time this question arises.
There are several activations (not to be replaced with fragments), you need to organize transitions between them.
Those. either we go after authorization immediately to the main screen of the closed part ( MainActivtiy ), or go to create an access code (which allows us not to enter a login and password each time). BUT we have already logged in!
I know several ways to solve this problem:
android:parentActivityName в манифесте startActivityForResult() followed by onActivityResult() .
Well, onBackPressed() .
Only confusion is constantly being generated - some kind of activation is saved or transitions are looped back by pressing the button ... finish () I call whenever I process pressing backward or when setResult(RESULT_CANCELLED); .
Picture:

Blue and green are the ideal scenario, the script is interested in the red arrows made. Simply put, when we are logged in and reluctant to do an access code, we need to go to the MainActivity screen.
Scenario:
Start, go to the authorization.
Logged in
Let's go create an access code codeEnter.
Moved to the next preConf screen.
Returned to codeEnter.
Returned to LoginActivity.
Returned to StartActivity.
It is important that the same script be executed by pressing the back button (in principle), we forget the actionBar for a while.