Android examples for android.media:RingtoneManager
get Ringtones
import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.database.Cursor; import android.media.AudioManager; import android.media.RingtoneManager; import android.net.Uri; import android.widget.ArrayAdapter; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; public class Main{ public static Map<String, Uri> getRingtones(Activity activity) { RingtoneManager manager = new RingtoneManager(activity); manager.setType(RingtoneManager.TYPE_RINGTONE); Cursor cursor = manager.getCursor(); Map<String, Uri> list = new LinkedHashMap<>(); while (cursor.moveToNext()) { String notificationTitle = cursor .getString(RingtoneManager.TITLE_COLUMN_INDEX); Uri notificationUri = manager.getRingtoneUri(cursor .getPosition());/* ww w . j a v a2 s .co m*/ list.put(notificationTitle, notificationUri); } return list; } }