Android AsyncTask called "multiple" times -


i'm new android programming. have main activity gets data db through service handler (url). want insert data well, on different activity, , want main activity date each time been called (onresume(),onrestart()). i've found on android api reference asynctask: the task can executed once (an exception thrown if second execution attempted.) mean cannot call asynctask whenever activity resumes, or cannot have multiple "instances" of asynctask running @ same time?

it literally means, while asynctask running, cannot launch again. in mainactivity.class have line:

task.execute();  

if task either finished or not , call method again exception thrown.

and put method in onresume() practice. 1 thing notice is: if put in onrestart() remember, callback works when change configuration, not called if create activity.

the doc lifecycle of activity.


Comments

Popular posts from this blog

How can we post XML strings along with text strings in iOS -

How to run C# code using mono without Xamarin in Android? -

c# - cefsharp app remember password option -