android - AsyncTask returned with multi objects -
i have code generating 2 objects. (arraylist , arraylist). code pulling data database , can take few seconds. looking wrap code around asynctask can add progress bar around it. not think can build them seperate cannot work out how return both of them activity. there way run code , give both objects. examples please time
not sure asking, here general code use:
public class someactivity extends activity { private progressdialog progressdialog; new sometask().execute(); public void requestfinished(string response) { if (progressdialog != null) { progressdialog.dismiss(); } } private class sometask extends asynctask<string, string, string> { @override protected void onpreexecute() { progressdialog = progressdialog.show(someactivity.this, "", "loading"); super.onpreexecute(); } @override protected string doinbackground(string... uri) { // db calls here } @override protected void onpostexecute(string response) { someactivity.this.requestfinished(response); } } }
hope helps...
Comments
Post a Comment