Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 941
Prosanto Avatar asked Sep 11 '13 03:09

Prosanto


1 Answers

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.

like image 172
Aniket Thakur Avatar answered Nov 05 '22 11:11

Aniket Thakur