https - RoboSpice. RequestListener doesn`t fire -


i`am using robospice receive , handle json answer server. have made in robospice tutorial: added service(networkspiceservice) in androidmanifest.xml, added needful libs, implemented special response object - simpleresponse @jsonignoreproperties(ignoreunknown = true).

the base activity:

public abstract class baseactivity extends activity {  private spicemanager spicemanager = new spicemanager(networkspiceservice.class); @override protected void onstart() {     spicemanager.start(this);     super.onstart(); }  @override  protected void onstop() {     spicemanager.shouldstop();     super.onstop(); }  public spicemanager getspicemanager() {     return spicemanager; } 

}

my work activity:

public class mainactivity extends baseactivity implements onclicklistener{ private static final string json_cache_key = "some_json"; private button button1;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     // ... }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main, menu);     return true; }   private void load() {     getspicemanager().execute(networkmanager.getjson(param), json_cache_key, durationinmillis.always_expired, new jsonrequestlistener()); }  private class jsonrequestlistener implements requestlistener<simpleresponse> {       @override     public void onrequestfailure(spiceexception spiceexception) {         log.e("json", "failure: " + spiceexception.getmessage());     }      @override     public void onrequestsuccess(simpleresponse simpleresponse) {         log.i("json", "response");         log.i("json", "response received. offset = " +  simpleresponse.getoffset() + " timezone = " + simpleresponse.gettimezone());     }  } 

netwokmanager class:

public class networkmanager { private static final string api_key = "....."; private static final string get_some_url = "https://api.servername.com/" + api_key + "/";  public static getrequest<simpleresponse> getjson(double param) {      return new  getrequest<simpleresponse>(simpleresponse.class, get_some_url + param);  } 

}

and getrequest:

public class getrequest<t extends simplerequest> extends     springandroidspicerequest<t> { private class<t> clazz; private string url;    public getrequest(class<t> clazz, string url) {     super(clazz);     this.clazz = clazz;     this.url = url; }   @override public t loaddatafromnetwork() throws exception {     return getresttemplate().getforobject(url, clazz); } 

so, after call of load() expected fire onrequestfailure(...) or onrequestsuccess(...) , nothing. convinced loaddatafromnetwork calling. on browser receive response address, not in app.

what wrong? may forgot something? or may https request needed handled in other ways?

where call private void load()? if part of clicklistener should fine. if method in oncreate() might have issue robospice hasn't been "started" yet , unbound request might queued execution , disregarded or returned without reference listener.

try overriding protected requestlistenernotifier createrequestrequestlistenernotifier() in implementation of spiceservice , throw bunch of breakpoints debug in implementation of defaultrequestlistenernotifier check what's calls.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -