Sunday, 15 January 2012

android - Robospice loadDataFromNetwork() not working -



android - Robospice loadDataFromNetwork() not working -

i using spring android in robospice. need place headers request used exchange() method. code has no error not fetch anything

public mlist loaddatafromnetwork() throws exception { httpheaders headers = new httpheaders(); headers.add(key,keyvalue); httpentity entity = new httpentity(headers); responseentity<mlist> response=getresttemplate().exchange(url,httpmethod.get,entity,mlist.class); homecoming getresttemplate().exchange(url, httpmethod.get,new httpentity<object> (headers),mlist.class).getbody(); }

resttemplate resttemplate=new resttemplate(); resttemplate.getmessageconverters().add(new mappingjackson2httpmessageconverter()); httpheaders headers = new httpheaders(); headers.add(key,keyvalue); httpentity entity = new httpentity(headers); responseentity<pojo> response=resttemplate.exchange(url,httpmethod.get,entity,pojo.class); homecoming response.getbody();

it worked when edited code this.

but got null pointer exception when used

resttemplate resttemplate=getresttemplate(); resttemplate.getmessageconverters().add(new mappingjackson2httpmessageconverter())

android resttemplate robospice spring-android

No comments:

Post a Comment