android - Stop Thread onPause -


When the user leaves the activity, I want to stop a thread, it is very easy, but no function, Which I tried, works.

I start the activity with code

  lovi = new intent (getApplicationContext (), listoverview.class); Lovi.putExtra ("reload all", true); StartActivity (lovi);   

On the on-crt of this list, I start the thread with code

  rlMF.start ();   

and RLMF looks like this:

  public threads RLMF = new thread (new runleball) (public zero run) {reloadMissingFiles ();}} );   

I am RLFstop (). Interrupted (), attempted to use .suspend to indirectly. Nothing stops

You have to add some flag to prevent this. Preventing threads by other means can have dire consequences, such as resource leaks.

For example:

  unstable bullian activity stopped = false;   

When creating runnable:

  public threads rlMF = new thread (new runleball) {public runs zero (while (! / Reload MissingFiles ();}}}) should be flagged to reload the missing files () in reality   

On-Pause ():

  Pause on secure punctuation () {super.onPause (); Anti-transgression = true; }    

Comments