Hello Iam newbie in android so dont judge too strong.I develop app where I have listview where i get json data and parse it using volley and stored in ArrayList so I wondered is there best and fastest way to update listivew now I have:
List.clear();
//volley request
...
adapter.notifyDataSetChanged();`
But its take a lot of time to updating if there are many data does anybody know how update like facebook etc.I am tried to use only make volley request and adapter.notifyDataSetChanged() but it gives me doubles data if update three times it gives copies data again how to solve this?I hesr about Set but i should have ordered list.NOTE:when making json request some data in server may deleted and also its must to deleted in listview in app Please HELP
JsonObjectRequest jsonReq = new JsonObjectRequest(Method.GET,
URL_FEED, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
VolleyLog.d(TAG, "Response: " + response.toString());
if (response != null) {
parseJsonFeed(response);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
}
});
void parseJsonFeed(JSONObject response) {
try {
JSONArray feedArray = response.getJSONArray("feed");
for (int i = 0; i < feedArray.length(); i++) {
JSONObject feedObj = (JSONObject) feedArray.get(i);
//addin response to views
}
// notify data changes to list adapater
listAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}