Question

I have an activity containing very complicated operation with many Threads and objects.

When I click on the "back" button to leave the activity, and then I restart it : all my threads do not work correctly. But if I kill the app and restart the activity, it works !

I think I have some static vars to clear, but there is some others problems (for example some Threads not finished etc !?).

So my question is : how to TOTALLY reset an Activity without leaving the app ?

Was it helpful?

Solution

I use a homemade MultiMap<Double, Thread> : the Double indicate the interrupt scheduling. This MultiMap is a TreeMap<Double, LinkedList<WeakReference<Thread>>>. Then I interrupt all threads with the right ordering. I must do this because some of my threads launch others threads.

Moreover, I set null all static vars in my package. But It's ugly because I must call public methods at the start of the Activity.

Thx for your comments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top