Hi all, i searched some example for getting resources (in my case i'm trying to get some strings but soon i must get json objects) and the example i found was this one:
String service="
http://localhost:8080/com.vogella.jersey.first/rest/hello";
ConnectionRequest req = new ConnectionRequest(){
@Override
protected void postResponse() {
}
@Override
protected void readResponse(InputStream input) throws IOException {
JSONParser p = new JSONParser();
// System.out.println(Util.readToString(input));
Dialog dd=new Dialog(Util.readToString(input));
hi.addComponent(dd);
}
};
req.setUrl(service);
req.setPost(false);
req.setContentType("text/xml");
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
req.setDisposeOnCompletion(dlg);
NetworkManager.getInstance().addToQueue(req);
the fact is this: i get the html resource because req.setContentType is declared after...how can i configure the connection without the override methods inside the constructor and getting the resource outside the constructor? thank you
IDE: Eclipse
Desktop OS windows xp
Simulator
Device