Reputation: 71
I am using Universal Image Loader library to load a grid and ListView
of a bunch of image URLs.
I have a method to pull 24 at a time, and add them to an ArrayList
.
My adapter basically gets the count from that ArrayList
, and displays them fine.
In my getView
method of the adapter, I have a check basically seeing if they are at the max image (the size of the ArrayList
), and if so, it runs another method to get 24 more.
This actually works GREAT, and loads another 24 images below, but after about 2-3 times, I get an error saying that the data has changed but the context doesn't know.
I tried to use a notifyDataSetChanged()
, but I put it in the adapter right after it runs the method for getting more images...now after 2-3x, I don't get an error, but I can't click any items anymore.
Is there a way to run notifyDataSetChanged()
in my method OUTSIDE of the adapter?
Upvotes: 0
Views: 499
Reputation: 3593
MyAdapter.notifyDataSetChanged();
MyAdapter here is your costomized adapter class's object.
Take a look at the code here.
Upvotes: 1