android - LoopJ AndroidAsyncHttp is returning response in OnFailure -


i new androidasynchttp.

i created class httptester :

 private static asynchttpclient client = new asynchttpclient();      public static void get(string url, requestparams params, asynchttpresponsehandler responsehandler) {         client.get(getabsoluteurl(url), params, responsehandler);     }      public static void post(string url, requestparams params, asynchttpresponsehandler responsehandler) {         client.post(getabsoluteurl(url), params, responsehandler);     }      private static string getabsoluteurl(string relativeurl) {         return  relativeurl;     } 

and in activity did following:

requestparams params = new requestparams();         params.put("ftid", httprequestuserauthentication.appid);         params.put("uuid", mainactivity.uuid);         params.put("type", "11");         params.put("datetimestamp", datetimestamp);         params.put("sdfversionnb", sdfversionnb);          httptester.post(mainactivitysharedpref.getvalue(myapplication.getcontext(), "webservice_url")+myapplication.getcontext().getresources().getstring(r.string.url_get_user_data), params,new jsonhttpresponsehandler() {             @override             public void onsuccess(int statuscode, header[] headers, string responsestring) {                 super.onsuccess(statuscode, headers, responsestring);                  log.e(tag, "sucess: " + responsestring);              }              @override             public void onfailure(int statuscode, header[] headers, string responsestring, throwable throwable) {                 log.e(tag, "failure: " + responsestring);                 log.e(tag, "failurecode: " + statuscode);                  super.onfailure(statuscode, headers, responsestring, throwable);             }          }); 

after calling client, correct response being returned being returned in onfailure , not in onsuccess. printed status code in onfailure , 200 supposedly should ok.

any appreciated.

so call in request

new jsonhttpresponsehandler() 

but need

new asynchttpresponsehandler() 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -