How to get OS Ringtone Picker dialog?

salmander

Active Member
Licensed User
Longtime User
Hello All,

I am trying to display Ringtone_Picker dialog which is the default in Android OS (which is shown in Alarm manager and when changing Ringtone). I searched the the b4a forum, but coudn't found anything. I checked the unfiltered log and open the default clock app in my phone, and this is what came up when i clicked on ringtone.
B4X:
Starting: Intent { act=android.intent.action.RINGTONE_PICKER cmp=android/com.android.internal.app.ResolverActivity (has extras) } from pid 4796

Does anyone know how to do this is basic4android? I tried the Dialogs library with ContentChooser and passed
B4X:
cc.Show("audio/ogg", "Choose audio file")
but the filemanager opens. I want to display the ringtones.
--Another Try--
Okay I put the below code in the button click event
B4X:
Dim rngintent As Intent
   rngintent.Initialize("android.intent.action.RINGTONE_PICKER","")
   rngintent.SetComponent("android/com.android.internal.app.ResolverActivity")
   StartActivity(rngintent)
and it does display the ringtone chooser dialog. But after selecting the ringtone, the dialog gets closed and i get returned to my app. How do I catch the directory and filename from the above dialog?
 
Last edited:

salmander

Active Member
Licensed User
Longtime User
You will not be able to get the ringtone picker result without the help of a library.

I thought the AHPreferenceActivity might be a good alternative.
Thanks Erel but I am following the AHPreferenceActivity tutorial and what I understand by it is that first there should be "AHPreferenceScreen" then there should be a "AHPreferenceCategory". And then, inside the category i can use "AddRingtone" method to display the Ringtone Picker dialog. But, what I am trying to achieve is display the Ringtone Picker without displaying another activity. Is it possible using this library? can you help me please?

Thanks.
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
I think that you understood correctly. This is how this library works.
Well I will wait for someone to provide the solution. Meanwhile, is there anyway i can browse internal memory using "ContentChooser"
B4X:
dim cc as ContentChooser

cc.Initialize("cc")
cc.Show("audio/*", "Choose audio file")
 
Upvote 0
Top