android - Robospice. Retry failed request on demand -


i need implement quite popular template of app behaviour - give opportunity user retry failed requests. right catch failed request spiceservicelistener, , shows dialog user can press "retry" button. unfortunately, using same cachedspicerequest object spicemanager.execute() don't give desired behaviour, because rs removing request listeners maprequesttolaunchtorequestlistener if request wasn't successful. request can work fine, not return information activity.

is there easy way (without modifying code of library) implement this?

unfortunately looks there no abstract solution situation this, had add code in every request.

    getspicemanager().execute(r, new requestlistener<countprofiles>() {         @override         public void onrequestfailure(spiceexception spiceexception) {             if (act.getsupportfragmentmanager().findfragmentbytag("network_problem") == null) {                 networkproblemdialogfragm.newinstance(r, this).show(act.getsupportfragmentmanager(), "network_problem");             } else {                 ((networkproblemdialogfragm) act.getsupportfragmentmanager().findfragmentbytag("network_problem")).setspicerequest(r);                 ((networkproblemdialogfragm) act.getsupportfragmentmanager().findfragmentbytag("network_problem")).setrequestlistener(this);             }         }          @override         public void onrequestsuccess(countprofiles countprofiles) {         }     }); 

networkproblemdialogfragm dialogfragment retry button, on click on button re execute failed request, using given requestlistener.

not beautiful solution, looks there no better one.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -