Hi Everyone,
I'm having a problem figuring out how to change the ringtone on a phone.
Here is the coding I have used so far:
This coding is in the main module.
This is the coding in the SoundFiles module. What I want to do here is show the title of the audio file instead of the uri of the chosen file in Activity_Create.
Here is where I try to change the ringtone.
Instead of the ringtone being changed to the one that was chosen, some sort of default ringtone is used no matter what file I choose with the ContentChooser.
I'm not sure what I'm doing wrong with this coding.
All help will be appreciated.
Thanks.
I'm having a problem figuring out how to change the ringtone on a phone.
Here is the coding I have used so far:
This coding is in the main module.
B4X:
Sub IconButtonSoundFiles_Click()
bm.Initialize(LoadBitmap(File.DirAssets,"sound files Pressed.png"))
IconButtonSoundFiles.setIcon(False,bm)
CC.Show("audio/*", "Choose an audio file")
End Sub
B4X:
Sub ContentChooser_Result (Success As Boolean, Dir As String, FileName As String)
If Success = True Then
SoundFiles.strUriChosen = FileName
StartActivity(SoundFiles)
End If
End Sub
This is the coding in the SoundFiles module. What I want to do here is show the title of the audio file instead of the uri of the chosen file in Activity_Create.
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("SoundFileProcessing")
Activity.Title = "Ringtone: " & strUriChosen
End Sub
Here is where I try to change the ringtone.
B4X:
bm.Initialize(LoadBitmap(File.DirAssets,"Ringtone Pressed.png"))
IconButtonSetAsRingtone.setIcon(False,bm)
If UserWantsToChangeSound("Ringtone") = True Then
rm.SetDefault(rm.TYPE_RINGTONE, strUriChosen)
ToastMessageShow("Your default Ringtone has been changed.", False)
Activity.Finish
End If
End Sub
Instead of the ringtone being changed to the one that was chosen, some sort of default ringtone is used no matter what file I choose with the ContentChooser.
I'm not sure what I'm doing wrong with this coding.
All help will be appreciated.
Thanks.