I have an AsyncHttpClient that makes a get request to an url. I will take the response of the method onSuccess(). I paste my code to a better explain..
CategoryActivity.java call method getXML of class "XMLParser". In this method it is the AsyncHttpClient.
XMLParser parser = new XMLParser(URL);
xml = parser.getXML(URL);
XMLParser.java has .getXML(url) and return a String. I create a variable xmlResponse to put response value but it doesn't.
public String getXML(String url) {
// get connection..
String xmlResponse = "";
AsyncHttpClient client = new AsyncHttpClient();
client.get(url, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
super.onSuccess(response);
xmlResponse = response;
}
@Override
public void onFailure(Throwable e) {
ma.showUserAlertQuestion();
}
});
return xmlResponse;
}
How can I get back this value? Thank you in advance & sorry for my bad english.