I have used AQuery to set up Image Loading via URL to set images to my ListView's ImageViews. However, the images are refreshed and reloaded every time I scroll by the images. Basically if I see the image once and then I scroll down and then if I scroll back up, the ImageViews are repopulated by the images again and thus it's very inconvenient for the experience.
In Instagram or Facebook: Once the images are loaded, they are intact and if I scroll by the same image the ImageView doesn't reload the images. I believed it's properly cached. How do I set up Caching for my ListView's ImageViews?
Here's my Adapter code:
AQuery aq;
public FeedAdapter(Activity a, ArrayList<ActivityTable> actList) {
activity = a;
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.actList = actList;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
final ActivityTable act = actList.get(position);
aq = new AQuery(activity);
holder.media = (ImageView) vi.findViewById(R.id.postphoto);
try {
aq.id(holder.media)
.progress(R.id.progress)
.image(act.getMediaURL(), false, true, 800,
R.mipmap.image_placeholder, preset,
AQuery.FADE_IN_FILE);
} catch (Exception ex) {
}
}
I have already tried this thing with aquery, Aquery library which you have used that maintains cache and appropriate as we need, But you have to use different urls for different images so that last image can be updated as you have told about instagram. As i know :- This is because android query checks for url of image, if different then refresh the new images otherwise get the bitmap from cache.
Work some more for the library it has many options. Thanks