public View getView(int position, View convertView, ViewGroup parent) { imginfo = imginfos.getItemAt(position); View view; ImageView photo; if (convertView == null) { view = LayoutInflater.from(context).inflate(R.layout.pic_layout, null); } else { view = convertView; } photo = (ImageView) view.findViewById(R.id.photo); photo.setTag(position); return view; }
private void loadBitmaps(int position, ImageView imageView) { ImgInfo data = imginfos.getItemAt(position); Bitmap bitmap = getBitmapFromMemoryCache(String.valueOf(data)); if (bitmap == null) { imageView.setImageResource(R.drawable.empty_photo); BitmapWorkerTask task = new BitmapWorkerTask(); taskCollection.add(task); task.execute(position); } else { if (imageView != null && bitmap != null) { imageView.setImageBitmap(bitmap); } } }
public int getCount() { return (null != imginfos) ? imginfos.getCount() : 0; }