Thursday, 15 July 2010

android - How to get video thumbnail from video id in sdcard smoothly ? -


I want to get video snippets of video ID which is stored in sdcard, smoothly. Actually, I already get thumbnails using bitmap, but when it's thumbnails it hangs a little main bag. I can process the process where I am the image and save it first in the cache memory so that my main thread will not hangup and in the end it will appear smoothly .......... Here is the bitmap process

ContentResolver crThumb = _context.getContentResolver ();

Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail (crThumb, _videoList.get (status) .getID (), MediaStore.Video.Thumbnails.MICRO_KIND, tap);

holder.thumbnail.setImageBitmap (curThumb);

After "text" itemprop = "text">

Getting thumbnails will take time directly from the video, so to take thumbnails in order, read thumbnails You can use asynctask for once you have thumbnails you can set to your imageView, `Public class ThumbnailFetcher extends asyncTask {

  string mVideoPath; Thumbnail manager callback m-mailback; Public Interface ThumbnailManagerCallback {Public Zero onThumbnailReivedived (bitmap thumnail, string path); } Public Thumbnail Fighter (Thumbnail Manager Callback Callback) {mCallback = callback; } @ Override protected bitmap doInBackground (string ... absolute) {// TODO auto generated method stub mVideoPath = param [0]; {Return thumbnail high.SantVideoTabalel (Ultimate [0], Thumbnail. MINI_KIND); } Hold (exception e) {return tap; }} @ Override Protected Zero at PostXextack (bitmap thumbnail) {if (thumbnail! = Zero) mCallback.onThumbnailReceived (thumbnail, mVideoPath); } ` 

Callback can be your adapter.


No comments:

Post a Comment