public void parseInfo(String genderTxt2, Boolean gender){
final String URL = "url" +
"?adult=" + isAdult.toString() + "&gender=" + genderTxt2;
info_text.setVisibility(View.GONE);
listview_progress.setVisibility(View.VISIBLE);
mRequestQueue.add(new JsonObjectRequest(Request.Method.GET,URL,null,new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if (!fPullToRefreshAttacher.isRefreshing()) {
names.clear();
}
VolleyLog.v("Response:%n %s", response.toString(4));
adapter.clear();
parseJSON(response);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// VolleyLog.e("Error: ", error.getMessage().toString());
Toast.makeText(acc, "Unable to load names list! Please check connection", Toast.LENGTH_LONG).show();
}
}));
mRequestQueue.start();
}
很简单,在许多设备上出现 OutOfMemory 异常。有任何想法吗?