Stopping Service Results In Orphaned Thread
I am continuing to study from the book 'Pro Android 2,' working through the Service example that consists of two classes: BackgroundService.java and MainActivity.java. The MainActi
Solution 1:
You should provide a 'running' boolean
.
while(running) {
//do your stuff
}
You want to make it something that you can update. Perhaps your Service
's onDestroy()
method should call a stopProcessing()
method on your Runnable
, which will set the 'running' boolean
to false
.
Post a Comment for "Stopping Service Results In Orphaned Thread"