Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.annotation.TargetApi;

import android.graphics.Bitmap;

import android.media.ThumbnailUtils;

import android.provider.MediaStore.Video.Thumbnails;

public class Main {
    @SuppressWarnings("finally")
    @TargetApi(8)
    public static Bitmap createVideoThumbnail(String filePath, final int width, final int height) {
        //return null;
        try {
            Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(filePath, Thumbnails.MINI_KIND);
            if (bitmap == null)
                return null;
            return android.media.ThumbnailUtils.extractThumbnail(bitmap, width, height);
        } catch (NoSuchMethodError e) {
            return null;
        } catch (NoClassDefFoundError e) {
            return null;
        } catch (Exception e) {
            return null;

        } finally {
            return null;
        }

    }
}