Hello! I want to dynamically load a ListView, for example, load them during the scrolling so its not loading all 100 posts I have. How can I achieve this?
I have looked at similiar solutions here at SO, but since I not got it to work, I asked this question.
My code:
//orders is my is my ArrayList<WithMyOwnOrderClass> that handling orders
/* adapter is my inner private class in this piece of code, that trigging
the getView */
if(orders != null && orders.size() > 0){
for(int i=0;i<orders.size();i++){
adapter.add(orders.get(i));
}
adapter.notifyDataSetChanged();
progressDialog.dismiss();
}
I have in the same .java file, functions to download the info from the web and loop through 100 items, like this:
JSONObject jObject = new JSONObject(queryResult);
SONArray docsArray = jObject.getJSONArray("array");
for (int i = 0; i < 100; i++) {
try {
title = docsArray.getJSONObject(i).optString("title");
} catch (JSONException e) {}
}
and then it add a new order correctly and so on. But now!(?) I want to have so when the first item is loaded, it should appear and when scrolling it loads gradually.
Hope that this can be achieved and thanks in advance for any help!