I have a listview with sounds items. I need, when a item is long press es, set it as ringtone or notification from raw sound of my app. How can I do this? Thanks
Asked
Active
Viewed 1,050 times
-1
-
So nothing solutions? – user3437592 Mar 29 '14 at 12:35
1 Answers
0
Answer from my other post here...
Set ringtone from res/raw folder
You cannot set the ringtone from resource.
RingtoneManager.setActualDefaultRingtoneUri expects the ringtone file in the device and the Uri should be from content resolver.
File ring = new File("pathOfYourFile");
Uri path = MediaStore.Audio.Media.getContentUriForPath(ring.getAbsolutePath());
RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_RINGTONE,path);
Also make sure to add permission