title: Dealing with threads
body: <p>What is the proper way to manage threads working in the background?</p>
  
  <p>For example, I have Activity that creates several threads. I need to do following:<br>
  <strong>1) Destroy all threads when Application is destroyed<br>
  2) Pause threads created within Activity if user navigate away from Activity<br>
  3) Destroy threads created within Activity if Activity is destroyed</strong></p>
  
  <p>The only thing that come to my mind would be to have all threads variables declared as public the to be able to issue t.destroy() or something similar on these events that I listed above.
  First, I am not sure if this is right way at all, and secondly, I don't like it because I will have to change code to make sure I can reference all threads I created.</p>
  
  <p>For example, I have situation where my Activity instantiate new object (ex. LoadImages.class) and that objects creates several thread depending on how many images is to be loaded. The threads are not visible from the calling activity.</p>
  
  <p><strong>So, do I have to pass threads references to calling activity, or there is some way to know who is the parent of the thread and destroy only thread with particular parent Activity?</strong></p>