Android examples for Media:Song
Returns title associated with song
//package com.java2s; import android.media.MediaMetadataRetriever; public class Main { /**//from w w w.j av a2s . c o m * Returns title associated with song * * @param filePath Path to song * @return Songs title, null on fail */ public static String getSongTitle(String filePath) { try { MediaMetadataRetriever metaRetriver = new MediaMetadataRetriever(); metaRetriver.setDataSource(filePath); return metaRetriver .extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE); } catch (Exception e) { return "N/A"; } } }