How I get the default ringtone list in android on programmatically?

Prosanto picture Prosanto · Sep 11, 2013 · Viewed 8.5k times · Source

I am android developer and want to create a android apps.In this apps ,it needed to show the android default ringtone list.But i can not show it.How to get the android default ringtone list .

Please help to me.

Answer

Aniket Thakur picture Aniket Thakur · May 2, 2015

I have upvote Yuichi's answer but it did not completely work for me. For each ringtone I was getting same URI (different title thought). Following code worked for me -

public void listRingtones() {
  RingtoneManager manager = new RingtoneManager(this);
  manager.setType(RingtoneManager.TYPE_RINGTONE);
  Cursor cursor = manager.getCursor();
  while (cursor.moveToNext()) {
    String title = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
    Uri ringtoneURI = manager.getRingtoneUri(cursor.getPosition());
    // Do something with the title and the URI of ringtone
  }
}

You can see the working app on playstore.