List of usage examples for android.media RingtoneManager getRingtone
public Ringtone getRingtone(int position)
From source file:Main.java
public static List<Ringtone> fetchAvailableRingtones(Context context) { List<Ringtone> ringtones = new ArrayList<>(); RingtoneManager mgr = new RingtoneManager(context); mgr.setType(RingtoneManager.TYPE_RINGTONE); int n = mgr.getCursor().getCount(); for (int i = 0; i < n; i++) { ringtones.add(mgr.getRingtone(i)); }//from ww w. j a v a 2 s. co m return ringtones; }
From source file:Main.java
public static List<Ringtone> fetchAvailableRingtones(Context context) { List<Ringtone> ringtones = new ArrayList<>(); RingtoneManager ringtoneManager = new RingtoneManager(context); ringtoneManager.setType(RingtoneManager.TYPE_RINGTONE); int count = ringtoneManager.getCursor().getCount(); for (int i = 0; i < count; i++) { ringtones.add(ringtoneManager.getRingtone(i)); } // END for/*from w ww. ja va 2s .com*/ return ringtones; }