java - getBaseContext() error for parsing data -


this code attempt registation.class android studio application parsing data.my code keeps giving me errors under getbasecontext() code @ end , have no idea why think looks ok!!! code lab should correct keep on getting errors!!!!

can tell me?? appreciated! thank

 public class attemptregistration extends     asynctask<string, integer, string> {  int success; string message = " ";  @override protected string doinbackground(string... args) {     try {         map<string, string> params = new hashmap<string, string>();         params.put("tag", "register");         params.put("username", args[0]);         params.put("password", args[1]);         params.put("email", args[2]);          //         httputility.sendpostrequest(params);          //           string response = httputility.readrespone();          jsonobject jobj = null;          try {              jobj = new jsonobject(response);              success = jobj.getint("success");             message = jobj.getstring("message");           } catch (jsonexception e) {             log.e("json parser", "error parsing data" + e.tostring());         }         } catch (ioexception ex) {             ex.printstacktrace();         }          httputility.disconnect();         return message;  }     protected void onpostexecute(string status) {      if (status !=null) {          toast.maketext(getbasecontext(), status, toast.length_long).show();          if(success == 1) {             startactivity (new intent(getbasecontext(), loginactivity.class));         }     } 

}

.my code keeps giving me errors under getbasecontext() code @ end , have no idea why think looks ok!!!

getbasecontext() method of contextwrapper. since getting cannot resolve method error, means asynctask class not defined inner class of class inherits contextwrapper (activity e.g). pass context asynctask .

public class attemptregistration extends asynctask<string, integer, string> {     private final context mcontext;     public attemptregistration(context context) {        mcontext = context;     } 

and use mcontext instead of getbasecontext()


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -