Can't get a video thumbnail in Android 2.0+ -


I also tried to make a video thumbnail as described, I also read the reference.

In my app I select a video to the first:

  startActivityForResult (new Intent (Intent.ACTION_GET_CONTENT) .setType ( "video / *"), ACTIVITY_PICKVIDEO);  

I determines the video ID with me:

  fileID = Puarnankkpriant (contentUri.getLastPathSegment ());  

Then, the video will be content: // media / external / video / media / 5 id5.

Then try to get the thumbnail bitmap with me:

  ContentResolver crThumb = getContentResolver (); Bitmapfactor Option option = new bitmapfile Option (); Options.inSampleSize = 1; Bitmap cut thumb = mediastore Video. Thumbels.tustible (CRThumb, fileID, MediaStore.Video.Thumbnails.MICRO_KIND, option);  

There is no exception to throw, but bitmap width and height -1 I'm not sure if getThubnail () need id , So really the identity that I had set up above.

Does anyone know how to get a work done How to get a thumbnail bitmap. Do you have content?

Interesting (probably because of) me MediaStore Video. Thumbnail size as thumbnail and an invalid authorization exception ("unsupported" when I try FULL_SCREEN_KIND .

I I am using Motorola Milestone with Android 2.1.

Edit: I also tried to get an ID with a query for Beskolmus. Similar to Uri (_ID 5 in the given example).

Video ID Prom Try it with your account

  string [] proj = {MediaStore.Video.Media._ID, MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.DATA}; cursor = went managed (Meediastorkvidiokmeedia.akstianel_ CONTENT_URI, Projects, Meediastor. Video. media .DISPLAY_NAME + "=?", new string [] { "name.mp4"}, null); Karsrkmovthofst () Fileid = CursorkgetLong (Karsrkgetcolmanindeks (Meediastorkvidio. media K_aidi));   

:

  ContentResolver crThumb = getContentResolver ( ); Bitmap cut thumb = mediastore Video. Thombs.TeabTable (CRT pillar, fileid, mediastore.video thumbnail.micri_iidid, option); Iv2.setImageBitmap (curThumb);  

Here is the iv2 image view and name.mp4 will represent your file name


Comments