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.ThumbnailUtils;

import android.provider.MediaStore;
import android.text.TextUtils;

public class Main {
    public static Bitmap getMediaFrame(String filePath) {
        if (TextUtils.isEmpty(filePath)) {
            return null;
        }
        Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Images.Thumbnails.MINI_KIND);

        bitmap = ThumbnailUtils.extractThumbnail(bitmap, 720, 387);
        return bitmap;
    }
}