Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.graphics.Bitmap;

import android.media.MediaMetadataRetriever;
import android.provider.MediaStore;

public class Main {
    public static Bitmap createVideoThumbnail(String filePath) {
        Bitmap bitmap = null;

        MediaMetadataRetriever retriever = new MediaMetadataRetriever();
        try {
            bitmap = android.media.ThumbnailUtils.createVideoThumbnail(filePath,
                    MediaStore.Video.Thumbnails.FULL_SCREEN_KIND);
        } catch (IllegalArgumentException ex) {
        } catch (RuntimeException ex) {
        } finally {
            try {
                retriever.release();
            } catch (RuntimeException ex) {
            }
        }

        return bitmap;
    }
}