简单说下,获取SDcard里的图片或者视屏缩略图就不说了,网上很多,主要写下加载图片的方式,在Grideview的Adapter中getView()方法中定义:
//异步加载图片,实现一张张显示
new LoadImageAsyctask(gridViewHold.icon).execute(paths[position]);
class LoadImageAsyctask extends AsyncTask<String, Void, Bitmap>{
ImageView view;
public LoadImageAsyctask(ImageView view) {
super();
this.view = view;
}
@Override
protected Bitmap doInBackground(String... params) {
// TODO Auto-generated method stub
Bitmap videoIcon = ThumbnailUtils.createVideoThumbnail(
params[0], Video.Thumbnails.MINI_KIND);
return videoIcon;
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
@Override
protected void onPostExecute(Bitmap result) {
// TODO Auto-generated method stub
this.view.setImageBitmap(result);
super.onPostExecute(result);
}
}