Skip to content Skip to sidebar Skip to footer

Doinbackground Doesn't Work Second Time

I have a synchronism logic makes sendOrder from db in android to server by web service which runs on doInBackgroud(). first I start app. then click SyncClick and It Sync database

Solution 1:

I haven't yet had a chance to work with AsyncTask, but the documentation says:

The task can be executed only once (an exception will be thrown if a second execution is attempted.)

That means you just need to create a new instance and execute on that one. E.g.

new WhateverYourTaskIsCalled().execute(...);

Rather than calling execute() on the instance you've already used.

Post a Comment for "Doinbackground Doesn't Work Second Time"