I have a problem with Android Asynchronous Http Client (http://loopj.com/android-async-http/). Until today I used the 1.4.6 version and my code (see below works without problem).
RestClient.get(MyUrl, null, new JsonHttpResponseHandler() {
@Override
public void onStart() {
Toast.makeText(getApplicationContext(), "START", Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Toast.makeText(getApplicationContext(), "OK", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
Toast.makeText(getApplicationContext(), "ERROR", Toast.LENGTH_SHORT).show();
}
});
Where RestClient is this:
public class RestClient {
private static final String BASE_URL = "http://www.example.com/action.php?";
private static AsyncHttpClient client = new AsyncHttpClient();
public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
client.get(getAbsoluteUrl(url), params, responseHandler);
}
public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
client.post(getAbsoluteUrl(url), params, responseHandler);
}
private static String getAbsoluteUrl(String relativeUrl) {
return BASE_URL + relativeUrl;
}
}
After upgrade Android Asynchronous Http Client library from 1.4.6 to 1.4.9 (the last) I get the error "method does not override or implement a method from a supertype" on Android Studio about onSuccess and onFailure methods.
Any ideas about whats is change on library? I have read the changelog but I cannot found a solution. Thanks.