android - General AsyncTask, use one AsyncTask in multiple contexts -


i'm using asynctask , examples found asynctask inside activity.

i'm trying make application lot of activity , must download html page. don't want copy-paste same code time in every activity. find dirty.

so need special class async httpget , pass function argument. execute after doinbackground (different every activity).

is possible or need copy-paste code in every activity , change in background need after downloading html page?

well can create listener asynctask completion, listens when asynctask completed , return data. had created example execute database queries in background thread , returning data activity. check it , can create similar asynctask problem.

update:-

  • also can use broadcastreceiver listener when asynctask completed , return value.
  • interface option creating listener asynctask. here demo github

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -