5
我试图连接意味着AsyncHttpClient
到我的网站上的PHP脚本。该脚本执行另一个页面的html解析,并将结果转换为json。它运作良好。但是,当我尝试使用json form java在android上使用它时,只有打开一个流并返回'响应'的方法不会运行onSuccess
和onFailure
。谁能帮我? 下面的代码:asyncHttpClient no onSuccess或onFailure运行
private String getStream() {
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://jem88.net/eventsAroundYouParser.php", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
System.out.println("response is here..."+response);
Log.d("eventstaker", "into response!!");
}
@Override
public void onFailure(Throwable e, String response) {
Log.d("eventstaker", "onFailure method is run... :(");
}
});
return "";
}`
我已经设置在清单中internet
和network_access
许可。 预先感谢您
谢谢您的回答mromer,你说对于检查更不可能性例外?如果我重写他人onFailure编译器告诉我重命名方法!所有其他异常在这个方法之前被检查..我不认为是一个例外! – marino
你可以重写'public void onFailure(Throwable arg0)' – mromer
好,但是我应该检查这个onFailure?对不起,我是新的java – marino