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.graphics.BitmapFactory;

import android.media.MediaMetadataRetriever;

public class Main {

    public static Bitmap getAudioImage(String audioPath) {
        MediaMetadataRetriever mmr = new MediaMetadataRetriever();
        Bitmap bitmap = null;
        try {
            mmr.setDataSource(audioPath);
            byte[] bb = mmr.getEmbeddedPicture();
            bitmap = BitmapFactory.decodeByteArray(bb, 0, bb.length);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bitmap;
    }
}