Question

I would like to implement an application for get the all ring tone names in a list from RingtoneManager.I have implemented my application for bring all ring tones which are available in device as follows:

   Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    startActivity(intent);

when start my application i am getting a dialog.In that dialog i have set of ring tones in a listview with radio buttons.I would like to print all items from that list into my application.

How can i print all items from the default ring tone manager listview?

Was it helpful?

Solution

Have you tried the getCursor() method of RingtoneManager?

As per the documentation:

public Cursor getCursor ()

Returns a Cursor of all the ringtones available. The returned cursor will be the same cursor returned each time this method is called, so do not close() the cursor. The cursor can be deactivate() safely. If RingtoneManager(Activity) was not used, the caller should manage the returned cursor through its activity's life cycle to prevent leaking the cursor.

OTHER TIPS

You can do

    RingtoneManager ringtoneManager = new RingtoneManager(yourActivity);
    ringtoneManager.setType(RingtoneManager.TYPE_RINGTONE);
    Cursor cursor = ringtoneManager.getCursor();
    while (cursor.moveToNext()) {
     System.out.println(cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX));
     System.out.println(cursor.getString(RingtoneManager.URI_COLUMN_INDEX));
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top