I have my own class called TimerControl that extends android.view.View. Inside TimerControl, I spawn a worker thread that should continue to work so while the Activity that the View is a part of is still alive. (i.e. onStop has not been called on the Parent Activity) I do not want to write the logic to kill the thread inside the Activity class because I want the View to work like other views where you don’t have to manage stuff like that from the Activity. How do I determine if the parent Activity of a View has been destroyed? (from the custom view itself)
I have my own class called TimerControl that extends android.view.View . Inside TimerControl ,
Share
You add a callback via which you will let your View know that the parent Activity has called onPause() and that the view should go into “pause” mode as well.
Unpause it when the activity gets the onResume() callback.