How to go to previous activity if the activity is killed by Android runtime? -
I had a problem with an app, that is, when I'm going to the previous window, the control goes to the splash screen My app because last activity is killed by the Android Runtime
How do I keep the past activity alive, or how can I make the activity again and how to use it with current activity.
You can use a default constructor to close and open the screen.
If you want to move between screens:
1-2-3-4 & amp; 4-3-2-1
Android will take care of it itself. For example, if you want to cross 4-2-3 in a specific way-1 if Android does not allow you, then just create a constructor and assign current activity to it and use that variable to close the screen at any time To do it. For example, here is the activity class
the public class increases an activity {private one screen; Public one () {screen = this; }}
Just use this when you want to stop this activity:
Screen.finish ();
instead of
this.finish ();
When you want to invoke a new activity of your choice, just use
Screen.finish (); I = new intent (i.e., YourActivity.class); Log.i (tag, "Calling your activity screen"); StartActivity (i);
If you want to pass any data between the screen, you can use
i.putExtra ("valuename", actual value) Are;
and you can withdraw the value using
intent startIntent = getIntent (); String realman = startIntent.getStringExtra ("valuename");
Comments
Post a Comment