Android - AsyncTask inside Fragment doesn't work in Marshmallow -


i created asynctask fetch scores. shows progressdialog split-sec , disappears. doinbackground method never gets executes. task called inside fragment.

private class getscore extends asynctask<string,string,string> {          @override         protected void onpreexecute() {             final progressdialog show = progressdialog.show(getactivity(), "", yourname);             super.onpreexecute();         }           @override         protected string doinbackground(string... args) {             scoremap = scorecalc.getengscore(yourname); //            toast.maketext(loveactivity.this, engagemap.tostring(), toast.length_short).show();             return null;         }           @override         protected void onpostexecute(string img) {         }     } 

. . . . . . .

   private void confirmyes() {      string s =medittext.gettext().tostring();         if(s.equals(""))             return;         new getscore().execute();     } 

help?

use asynctask class instead of class if query let me know.

public class getscore extends asynctask<string, void, string> {     string method;     @override     protected string doinbackground(string... arg0)     {         method = arg0[0];         return getdata.callwebservice(arg0[0], arg0[1]);     }     protected void onpostexecute(string xmlresponse)     {         if(xmlresponse.equals("") )         {             try{                 if(progdialog!=null && progdialog.isshowing()){                     progdialog.dismiss();                 }             }catch(exception ex){}             toast.         }         else         {             if (method.equals("getseatarrangementdetails_stax"))             {                  methodname(xmlresponse, "responsetag");                  try{                     if(progdialog!=null && progdialog.isshowing()){                         progdialog.dismiss();                     }                 }catch(exception ex){}                  //what ever want                 }             }         }     } } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -