If by photo you mean a thumbnail then the following code could be of use to you:
int id = **"The Video's ID"**
ImageView iv = (ImageView ) convertView.findViewById(R.id.imagePreview);
ContentResolver crThumb = getContentResolver();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 1;
Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail(crThumb, id,
MediaStore.Video.Thumbnails.MICRO_KIND, options);
iv.setImageBitmap(curThumb);
You then just have to link this code to a button press using the Android onClickListner
. A simple example using a listener would be like this:
final Button button = (Button) findViewById(R.id.button_id);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
}
});
Finally to save the thumbnail to the SD card you should take a look at this answer:
Android Save images to SQLite or SDCard or memory
.
stackoverflow.comm
No comments:
Post a Comment