P pdauwe New Member Licensed User Longtime User Dec 21, 2020 #1 The following code causes the java exception "java.lang.NullPointerException" (see Exception.txt attachment). Dim oRM As RingtoneManager . . . Log("rtfile = " & rtfile) Log("st = " & st) u = oRM.AddToMediaStore(File.DirRootExternal & "/Ringtones", rtfile, st, False, False, True, False) . . . Directory Ringtones resides in the phone File.DirRootExternal directory. The ringtone file '_Another_brick_in_te_wall.mp3' exists in the Ringtones directory. B4A version : 10.2 B4A is a wonderful product. Thank you for any help. Attachments Exception.txt Exception.txt 1.3 KB · Views: 602 Last edited: Dec 21, 2020
The following code causes the java exception "java.lang.NullPointerException" (see Exception.txt attachment). Dim oRM As RingtoneManager . . . Log("rtfile = " & rtfile) Log("st = " & st) u = oRM.AddToMediaStore(File.DirRootExternal & "/Ringtones", rtfile, st, False, False, True, False) . . . Directory Ringtones resides in the phone File.DirRootExternal directory. The ringtone file '_Another_brick_in_te_wall.mp3' exists in the Ringtones directory. B4A version : 10.2 B4A is a wonderful product. Thank you for any help.
DonManfred Expert Licensed User Longtime User Dec 21, 2020 #2 Please post Errors as TEXT (right click to copy)
Erel B4X founder Staff member Licensed User Longtime User Dec 21, 2020 #3 Please upload a small project that demonstrates the problem.
P pdauwe New Member Licensed User Longtime User Dec 21, 2020 #4 Erel said: Please upload a small project that demonstrates the problem. Click to expand... Prject included. Thanks Attachments AddMedia.zip AddMedia.zip 427.1 KB · Views: 512
Erel said: Please upload a small project that demonstrates the problem. Click to expand... Prject included. Thanks
Erel B4X founder Staff member Licensed User Longtime User Dec 22, 2020 #5 1. You are not handling the permission correctly. It shouldn't be inside the FirstTime block. 2. The file name was wrong. I've changed it to: Code: Copy Dim u As String = oRM.AddToMediaStore(File.DirRootExternal & "/Ringtones", "_Money.mp3", "_F355", False, False, True, False) Worked fine.
1. You are not handling the permission correctly. It shouldn't be inside the FirstTime block. 2. The file name was wrong. I've changed it to: Code: Copy Dim u As String = oRM.AddToMediaStore(File.DirRootExternal & "/Ringtones", "_Money.mp3", "_F355", False, False, True, False) Worked fine.
P pdauwe New Member Licensed User Longtime User Dec 22, 2020 #6 OK. I tried again: the problem occurs when the file has already been defined. How can we know the URI of already defined files? Thanks
OK. I tried again: the problem occurs when the file has already been defined. How can we know the URI of already defined files? Thanks
Erel B4X founder Staff member Licensed User Longtime User Dec 22, 2020 #7 I don't see any bug here. For further discussion, please start a new thread in the questions forum.