【发布时间】:2015-11-11 08:18:45
【问题描述】:
我在http://www.raywenderlich.com/78578/android-tutorial-for-beginners-part-3学习宁静服务
偶遇时
AsyncHttpClient client = new AsyncHttpClient();
client.get(QUERY_URL + urlString,
new JsonHttpResponseHandler() {
@Override
public void onSuccess(JSONObject jsonObject) {
// Display a "Toast" message
// to announce your success
Toast.makeText(getApplicationContext(), "Success!", Toast.LENGTH_LONG).show();
// 8. For now, just log results
Log.d("omg android", jsonObject.toString());
}
@Override
public void onFailure(int statusCode, Throwable throwable, JSONObject error) {
// Display a "Toast" message
// to announce the failure
Toast.makeText(getApplicationContext(), "Error: " + statusCode + " " + throwable.getMessage(), Toast.LENGTH_LONG).show();
// Log error message
// to help solve any problems
Log.e("omg android", statusCode + " " + throwable.getMessage());
}
});
我的 gradle 同步任务成功了。但是我不明白为什么 onSuccess 方法被启发为(方法不覆盖超类)
即使我已经将 onSuccess() 参数更改为
public void onSuccess(int statusCode, org.apache.http.Header[] headers, JSONObject jsonObject)
我也遵循了以下链接中提供的所有解决方案
method does not override or implement a method from a supertype - for Override
即使我也尝试过使用接口。而且我使用的是异步 http 1.4.9 所以我把gradle脚本改成了
dependencies {
...
// there may or may not be a support library above these
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.squareup.picasso:picasso:2.5.2'
}
我已经尝试了 stackoverflow 和 github 中可用的所有解决方案。但我仍然无法清除该错误,它显示 onSuccess() 和 onFailure() 方法不会覆盖超类
【问题讨论】:
标签: java android rest asynchttpclient