private class CustomAdapter extends CursorAdapter {
@Override
public void bindView(View view, Context context, Cursor cursor) {
if (view != null) {
String url = cursor.getString(CONTENT_URL_COLUMN);
ViewHolder viewHolder = (ViewHolder) view.getTag();
final ImageView imageView = viewHolder.mImageViewIcon;
final TextView textView = viewHolder.mTextViewName;
Picasso.with(context).load(url).into(new Target() {
@Override
public void onBitmapLoaded(Bitmap arg0, LoadedFrom arg1) {
imageView.setImageBitmap(arg0);
imageView.setVisibility(View.VISIBLE);
textView.setVisibility(View.GONE);
}
@Override
public void onBitmapFailed(Drawable arg0) {
imageView.setVisibility(View.GONE);
textView.setVisibility(View.VISIBLE);
}
});
}
}
}
}
If the list of images is already loaded, then when you quickly scroll through the list,
the onBitmapLoaded () method is called and loads the image from the memory cache. But sometimes it calls onBitmapFailed () . Why?
source
share