this in console:
onsuccess(int, header[], jsonobject) not overriden, callback received
i verified , file uploaded server.
this code , app doesn't complain :
public void uploadimage() { //create new requestparams send paremeters our asynchttpclient request. requestparams data = new requestparams(); //adding our image parameters. file image = new file(imgpath); try { data.put("image", image); } catch(filenotfoundexception e) {} //create new asynchttpclient request. //here we're sending post request, first parameter request url // our requestparams, in our case data , json response handler. asynchttpclient client = new asynchttpclient(); client.post(file_upload_url, data, new jsonhttpresponsehandler() { @override public void onsuccess(int statuscode, header headers[], jsonarray success) { try { jsonobject data = success.getjsonobject(0); string m = data.getstring("message"); toast.maketext(uploadphototest.this, m, toast.length_long).show(); } catch (jsonexception e) { e.printstacktrace(); } } }); }
and i'm importing if it's relevant :
import com.loopj.android.http.asynchttpclient; import com.loopj.android.http.jsonhttpresponsehandler; import com.loopj.android.http.requestparams; import org.apache.http.header; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject;
my problem whatever in onsuccess never gets executed .. put log in onsuccess try , catch , nothing gets printed. how can solve ?
public void onsuccess(int statuscode, header[] headers, jsonobject response) {
this works me.
Comments
Post a Comment