Sending Activity to background without finishing

Viewed 42259

How can I make an activity go to background without calling its finish() method and return to the Parent activity that started this? I tried so much but I could not find a solution. So if you guys could help I would be very thankful.

5 Answers

Try:

 Intent toNextActivity = new Intent(CurrentActivity.this,
                                     NextActivity.class);
 CurrentActivity.startActivity(toNextActivity);

If you use this way, the method onPause() from CurrentActivity will be called and if you have a static variable (like a MediaPlayer object) in CurrentActivity it will continue to exist (or play if it is playing)..

I'm using that in my application but I found a better way to do that with services.

Hope this will help you!

Related