我想将数据库中的视频显示到网格视图中,但是我设法通过图像进行处理,但是不知道如何通过videoview进行处理,我想对视频进行相同处理
public class Photoadapter extends BaseAdapter {
private Context context;
private int layout;
private ArrayList<Photo> photoList;
@Override
public int getCount() {
return photoList.size();
}
@Override
public Object getItem(int position) {
return photoList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
private class ViewHolder {
ImageView imageView;
}
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
View row = view;
ViewHolder holder = new ViewHolder();
if (row == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(layout, null);
holder.imageView = (ImageView) row.findViewById(R.id.imageViewList);
row.setTag(holder);
} else {
holder = (ViewHolder) row.getTag();
}
final Photo photo = photoList.get(position);
final byte[] photoImage = photo.getImage();
final Bitmap bitmap = BitmapFactory.decodeByteArray(photoImage, 0, photoImage.length);
holder.imageView.setImageBitmap(bitmap);
return row;
}
public Photoadapter(Context context, int layout, ArrayList<Photo> photoList) {
this.context = context;
this.layout = layout;
this.photoList = photoList;
}
}