Android examples for Android OS:Alarm Information
get Alarm Ringtones
//package com.java2s; import android.app.Activity; import android.database.Cursor; import android.media.RingtoneManager; import android.net.Uri; 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());/* w w w . j av a 2 s .co m*/ list.put(notificationTitle, notificationUri); } return list; } }