android - how to LoopJ AndroidAsyncHttp with retry dialog -
i try extends asynchttpclient 1 boolean argument on true show dialog , retry connection don't how can access user sent asynchttpresponsehandler onfailure event, , can't show retry dialog
so retry extends asynchttpresponsehandler this:
import org.apache.http.header; import android.graphics.color; import android.graphics.drawable.colordrawable; import android.view.view; import android.view.view.onclicklistener; import com.loopj.android.http.asynchttpclient; import com.loopj.android.http.asynchttpresponsehandler; public class cuasynchttpresponsehandler extends asynchttpresponsehandler { private cuactivity activity; private boolean retry; private cuasynchttpresponsehandler response; public void cuasynchttpresponsehandler(cuactivity activity) { this.activity = activity; this.retry = false; this.response = this; } public cuasynchttpresponsehandler(cuactivity activity, boolean retry) { this.activity = activity; this.retry = retry; this.response = this; } public void onfailure(int statuscode, header[] headers, byte[] errorresponse, throwable e) { if (this.retry == true) { final cudialogretry cdd = new cudialogretry(activity, null, true); cdd.getwindow().setbackgrounddrawable( new colordrawable(color.transparent)); cdd.show(); cdd.getretrybutton().setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { response.onstart(); cdd.dismiss(); } }); } } @override public void onsuccess(int arg0, header[] arg1, byte[] arg2) { } }
but onstart don't restart request(because response , don't have access retry client send request
Comments
Post a Comment