I have an asyncHttpClient that receives a request for the URL. I will answer the method on success (). I can paste my code for better interpretation.
Category attachment. Java call method getXML class "XMLParser" In this method it is AsyncHttpClient. XMLParser.java has .getXML (url) and return a string. I am creating a variable xmlResponse to put the response value but it is not. How can I return this value? Thanks in advance; Sorry for my bad english I have the same problem in the other context you can see it here: I also have a solution I'm searching, but I do not get it right now. The reason for this is that you do not get any results in your return value, it is simple when you do: the client.get () message is sent to the server to return xmlResponse from your code The on-suuse method goes away from arbitration, it will be said after the return, because the software receives the return statement faster than the message from the async call by the server. In this topic I have shown you above that there is a solution for this. But for the way I employed my application, this solution could not have been fit for it to fit into your application.
XMLParser parser = new XMLParser (URL); Xml = parser.getXML (URL);
get public string getXML (string URL) {// connection. String xmlResponse = ""; AsyncHttpClient Client = New AsyncHttpClient (); Client.get (url, new asyncHttpResponseHandler) {@Override Success on Public Zero (String Response) {super.onSuccess (feedback); XmlResponse = response;} @Override Failure on Public Zero (throwable e) {ma.showAserAlertQuestion ();}}); Return xmlResponse; }
No comments:
Post a Comment