android - How to start AsyncTask from another class? -


i execute doinbackground() method of asynctask inner class of articlelistfragment_develop.class class. how go doing this. please can me syntax? have tried few things , keep getting errors.

  public class articlelistfragment_develop extends listfragment {      ........   private class downloadxmltask extends         asynctask<string, void, arraylist<article>> {     /*      * @override protected void onpreexecute() { pdialog = new      * progressdialog(getactivity());      * pdialog.setmessage("loading search results...");      * pdialog.setindeterminate(true);      * pdialog.setcanceledontouchoutside(false); pdialog.show(); }      */     @override     protected arraylist<article> doinbackground(string... urls) {         log.d(tag, "downloadxmltask thread id: "                 + thread.currentthread().getid());          try {             return loadxmlfromnetwork(urls[0]);         } catch (xmlpullparserexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }         return articles;     } 

write asynctask in seperate class file , use it.

new downloadxmltask().execute(); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -