how to get phone ringtone type name in android programmatically instead of getting ringtone id
android, ringtone
Solution
I got the solution using below code :
Inside onActivityResult:
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
Ringtone r=RingtoneManager.getRingtone(this, uri);
String ringToneName=r.getTitle(this));
Toast.makeText(getApplicationContext(), "Ringtone Name : +ringtonename+"",Toast.LENGTH_SHORT).show();
But it will show exception in emulator because there is no ringtone in emulator so execute this in mobile
Problem
how to get phone ringtone type name in android programmatically.I can get only the ringtone id(`://media/internal/audio/media/53`).How can get ringtone `name(panic)` instead of `id(53)`.Please help me. I used following code to get the ringtone name : ``` Uri mUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); Cursor mCursor = query(mUri, null, null,null, null); mCursor.moveToFirst(); String ringtoneName= Cursor.getString(mCursor.getColumnIndex("title")); Toast.makeText(getApplicationContext(), "Ringtone"+ringtoneName+"", Toast.LENGTH_SHORT).show(); ``` But it shows null pointer exception