Android examples for Media:Song
get MediaStore All Songs
//package com.java2s; import android.content.Context; import android.database.Cursor; import android.provider.MediaStore; import java.util.ArrayList; public class Main { private static String[] audioColumns = new String[] { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DURATION, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.YEAR, MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.SIZE, MediaStore.Audio.Media.DATA }; public static ArrayList getAllSongs(Context context) { Cursor cursor = context.getContentResolver().query( MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, audioColumns,/*from ww w . j a v a 2 s. c o m*/ MediaStore.Audio.Media.MIME_TYPE + "=? or " + MediaStore.Audio.Media.MIME_TYPE + "=?", new String[] { "audio/mpeg", "audio/x-ms-wma" }, null); while (cursor.moveToNext()) { } cursor.close(); return null; } }