Fast-Android-Networking
Fast-Android-Networking copied to clipboard
Question : How to handle this response
?({ "Years": {"min_year":"1941", "max_year":"2019"} });
New to this library. @amitshekhariitbhu Can you please help
I've tried this yet void getYears() {
Gson gson = new GsonBuilder()
.setLenient()
.create();
AndroidNetworking.setParserFactory(new GsonParserFactory(gson));
AndroidNetworking.get("https://www.carqueryapi.com/api/0.3/?callback=?&cmd=getYears")
.setTag("getYears")
.setPriority(Priority.IMMEDIATE)
.build()
.getAsOkHttpResponse(new OkHttpResponseListener() {
@Override
public void onResponse(Response response) {
// do anything with response
if (response.isSuccessful()) {
Constant.showSuccessToast(response.message(), getApplicationContext());
}
}
@Override
public void onError(ANError anError) {
// handle error
Constant.showErrorToast(anError.getMessage(), getApplicationContext());
}
});
}