0

I can't really show anything here I think. It's not a problem in my code I think.

What I mean is when I'm running my program directly from my android device, or when it's connected to the USB on my PC through android studio in debug mode, or regular running in all cases when my program is running and then I open a new app on my phone or if I just move to the whatsapp to type something when I want to get back to my program I see it was close. And I need to run the program over again.

How can I keep my program to be running all the time in the background so I can get back to it and no need to run it over again?

MWiesner
  • 8,868
  • 11
  • 36
  • 70
Daniel Lip
  • 3,867
  • 7
  • 58
  • 120
  • 2
    Your question is a bit vague. You cannot force an app to continue running in background. It can have a service that runs in background and you can save values to make the app restore it's previous state once opened again after leaving. – cYrixmorten Aug 05 '15 at 18:31
  • cYrixmorten how fo example i checked now the game backgammon live on my device is working ? I just ran it and then i went to whatsapp and to another app and when i went back to the game it was on same where it was last time i mean the wasn't running over again from the start. – Daniel Lip Aug 05 '15 at 18:38
  • 1
    I'm guessing you don't mean that it crashes. Your example sounds like onPause + onResume. Nothing weird. – keyser Aug 05 '15 at 18:51
  • just like he explained you can save state and restore read more about it before posting anything on SO – rahul tyagi Aug 05 '15 at 18:52
  • @SharonGaziel. Kindly go thoroughly through Android Activity life cycle first. Here's a good post that can surely help you understand pertaining an Activity State. [link to post](http://stackoverflow.com/q/151777) – Prashant Aug 05 '15 at 19:06

0 Answers0