dimanche 24 janvier 2021

How to update my TextView from AsyncTask if I change activity an go back

I have myProgressTextView in MainActivity. Inside MainActivity I launch a long process using an asyncTask: MyTask.execute(getApplicationContext(),myProgressTextView) Using publishProgress and onPostExecute I'm able to update myTextView and works all like a charm.

I have a problem navigating between others activities and return back to MainActivity. Passing again through onCreate of MainActivity myTextView reference is changed and I'm not longer able to update my UI ( myTextView ) from MyTask that is still running. What is the right solution in this case?

Aucun commentaire:

Enregistrer un commentaire