My application is starting a continously running thread which runs a while(true){}. When I reopen/reenter the application another thread is created and works concurrently with the previous. I would like a mechanism which could check whether a thread from a previous session is still running and if it does then it shouldn’t recreate it. How to achieve that?
My application is starting a continously running thread which runs a while(true){}. When I
Share
In your thread create a
When your thread starts
put it in the apps shared preference like this..
Now when the thread is Finished just change it back to false.
In your activity just pull the boolean out of shared preference like this.
This is a very easy way to do it.
Hope it helps