Java tutorial
//package com.java2s; //License from project: Apache License import android.media.MediaMetadataRetriever; import android.util.Log; public class Main { public static final String LOG_TAG = "MultimediaGridHelper"; public static MediaMetadataRetriever initMetadataRetriever(String URI) { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); if (!URI.contains("http:") && URI.endsWith("mp3")) { try { retriever.setDataSource(URI); } catch (Exception e) { Log.d(LOG_TAG, "Failed: " + URI + " " + e.toString()); e.printStackTrace(); return null; } } else { return null; } return retriever; } }