Code example for SimpleCursorAdapter

0
import android.widget.ImageView; 
import android.widget.TextView; 
 
public class GalleryAdapter extends SimpleCursorAdapter {
    public GalleryAdapter(Context context) {
        super(context, -1, null, new String[] {}, new int[] {}, 0);
    } 
 
    @Override 
	public View getView(int position, View convertView, ViewGroup parent) {
        Cursor c = (Cursor) getItem(position);
	    ViewHolder holder = null;
 
		if (convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.grid_item, parent, false);
 
			holder = new ViewHolder();
			holder.image = (ImageView) convertView.findViewById(R.id.image);
			holder.title = (TextView) convertView.findViewById(R.id.title);
 
			convertView.setTag(holder);