Hy!
I want to make some http calls to a restserver from my android client. I created a class for rest calls. I followed the http://loopj.com/android-async-http/ description:
My question is that how can I send back anything from onSucces() method? For example I have the following function:
public class RestController {
public String getName() throws JSONException {
TwitterRestClient.get(url, null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
String name;
try {
name = response.getString("name");
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
}
How can I return the name to getName function?
function () {
...
String name = restController.getName();
...
do something with the name
Thank you very much! I will apreciate any kind of help!