Back to project page UniversalImagePick.
The source code is released under:
Apache License
If you think the Android project UniversalImagePick listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.luffyjet.universalimagepick.adapter; /* w ww. j av a 2s. c om*/ import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.ImageView; import com.luffyjet.universalimagepick.App.ImgLoaderOpts; import com.luffyjet.universalimagepick.R; import com.luffyjet.universalimagepick.model.Image; import com.nostra13.universalimageloader.core.ImageLoader; public class PickGridAdapter extends BaseAdapter { private ArrayList<Image> mList = new ArrayList<Image>(); private Context mContext; public PickGridAdapter(ArrayList<Image> mList, Context mContext) { super(); this.mList = mList; this.mContext = mContext; } @Override public int getCount() { return mList.size(); } @Override public Image getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vHolder = null; Image image = getItem(position); if (null==convertView) { vHolder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.image_pick_item, null); vHolder.imageView = (ImageView) convertView.findViewById(R.id.image); vHolder.checkBox = (CheckBox) convertView.findViewById(R.id.checkbox); convertView.setTag(vHolder); }else { vHolder = (ViewHolder) convertView.getTag(); } ImageLoader.getInstance().displayImage("file://"+image.path,vHolder.imageView,ImgLoaderOpts.forImgSelect); return convertView; } static class ViewHolder{ public ImageView imageView; public CheckBox checkBox; } }