我使用循环j从我的应用程序中的服务器获取数据。但它始终取得旧的回应。我在postman上测试我的api并从服务器获得最新的响应。 如果有人知道如何清除缓存中的循环j旧响应?
这是我的代码
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://bnailsusa.com/app_api/getView.php?serviceprovider", new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, cz.msebera.android.httpclient.Header[] headers, JSONArray response) {
Log.d("Tag:", String.valueOf(response));
try {
for (int i=0;i<=response.length();i++){
//region Fetching
JSONObject index=response.getJSONObject(i);
String name=index.getString("Name");
String spid=index.getString("spid");
String Photo=index.getString("PHOTO");
//endregion
//region Storing
names.add(name);
SPID.add(spid);
images.add(Photo);
Log.d("Tag:ar", String.valueOf(names));
//endregion
}
} catch (JSONException e) {
e.printStackTrace();
}
ProvidersAdapter booksAdapter = new ProvidersAdapter(SelectServiceProvider.this, names,images);
gridView.setAdapter(booksAdapter);
}
public void onFailure(int statusCode, cz.msebera.android.httpclient.entity.mime.Header[] headers, Throwable throwable, JSONObject errorResponse){
}
});