Override getCount(), getItem(), getItemId(), getView().
getView() is creating ImageView from video clip.
getCount() return is SDCard Video Clip Number
public int getCount() { Cursor c = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, null, null, null,null); return c.getCount(); }
getItem() is no use.
public Object getItem(int arg0) { return null; }getItemId() is no use.
public long getItemId(int position) { return 0; }This is getView()..
I create Cursor and move position.
Cursor c = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, null, null, null,null); c.moveToPosition(position);check file path.
int dataIndex = c.getColumnIndex(MediaStore.Video.Media.DATA); String path = c.getString(dataIndex);get thumbnail bitmap.
Bitmap bmp = ThumbnailUtils.createVideoThumbnail(path,MediaStore.Video.Thumbnails.MINI_KIND );setView.
imageView.setImageBitmap(bmp);view set adapter extends BaseAdapter.
mGridView = (GridView)findViewById(R.id.gridView1); mGridView.setAdapter(new ImageAdapter());source code is here.
0 件のコメント:
コメントを投稿