Search code examples
androidgridviewadapternotifydatasetchanged

How to Add item to GridView dynamically on Android without notifyDataSetChanged?


I have a gridview with custom adapter. it's added photo from background service by notifyDataSetChanged of adapter method. but its method re-created all items. the items took many times to create. the reason why items is part of a photo.

So, i want to add dynamically item to add.


Solution

  • It's not clear if you want to add a new View or just refresh an old one. You can update a single view already in the GridView by calling getView() on it. The accepted answer here has worked for me for ListView, I'm sure it will be similar for GridView.

    For no hassle loading of images I recommend Picasso.