I have three actions: - SplashActivity - Main activity - PlayerActivity
Of course, the application starts with SplashActivity, then MainActivity starts and closes. MainActivity at some point starts PlayerActivity and goes back and forth. (MainActivity is alive, but onStop is located) Then I need to open MainActivity and set PlayerActivity for the background (PlayerActivity is alive, but it's on). Then I need to open PlayerActivity again and set MainActivity for the background.
Thus, PlayerActivity and MainActivity often get onPause () and onStop () without onDestroy when the application switches from one to the other and back.
I need to complete all the actions and launch the SplashActivity application every time the user presses the "home" button, but the home button does the same as the switch between the actions (onPause () and onStop ()). Therefore, I canβt understand how to kill actions.
Please, help.
Editorial: Unfortunately, onUserLeaveHint does not help, the same thing. If the user presses HOME, this calls:
onUserInteraction, onUserLeaveHint, OnPause, OnStop
This operation returns the previous activity (Home) without any user action.
the public class PlayerActivity extends the action {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_next); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(PlayerActivity.this, MyActivity.class)); } }, 5000); }
}
But still there is the same thing:
onUserInteraction, onUserLeaveHint, OnPause, OnStop