1

This is continuation to the question I already asked a while back. I've been offered a solution which is not really working. Anyway - here's the problem/question

I look at some posts from the past and it seems that if I add items to the ListView adapter it should update itself and user should be able to scroll to the newly appended items. Unfortunately it's not what I observe. If I append new items to my existing ArrayAdapter I only will see updated results if I rerun ListView#setAdapter again. Doing nothing, invalidating view etc. doesn't do anything. Here's a snippet:

SearchItemsAdapter a = (SearchItemsAdapter) listview.getAdapter();
List<SearchItem> values = fetchNextSetOfItems();
a.append(values);
// unless I do this - I will not see the update, but if I do - 
// I'll jump to the top
listview.setAdapter(a);

Here's append method:

public void append(List<SearchItem> values) {
        this.items.addAll(values);
}

Anything I'm missing?

Community
  • 1
  • 1
Bostone
  • 36,858
  • 39
  • 167
  • 227

1 Answers1

2

Don't add items to the ArrayList. Add them to the ArrayAdapter.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks sir... can we make the gridview load from the view we added at last, Instead it is now loading from first and then adding the views – TechArcSri Feb 06 '14 at 14:18