yfleury Active Member Licensed User Longtime User Jul 21, 2022 #1 I have a json file (BornesFontaines.json) in download folder I use this for take json file for translate json to db. B4X: Copy Dim test As ContentChooser test.Initialize("boiteDialog") test.Show("text/*","fichiers") With .json haven't raise event. I rename file with .txt B4X: Copy public Sub boiteDialog_Result (Success As Boolean, Dir As String, FileName As String) Log(Success & " - " & Dir & " - " & FileName) End Sub and I have this in log true - ContentDir - content://com.android.providers.downloads.documents/document/msf%3A5646 Waht I am doing wrong?
I have a json file (BornesFontaines.json) in download folder I use this for take json file for translate json to db. B4X: Copy Dim test As ContentChooser test.Initialize("boiteDialog") test.Show("text/*","fichiers") With .json haven't raise event. I rename file with .txt B4X: Copy public Sub boiteDialog_Result (Success As Boolean, Dir As String, FileName As String) Log(Success & " - " & Dir & " - " & FileName) End Sub and I have this in log true - ContentDir - content://com.android.providers.downloads.documents/document/msf%3A5646 Waht I am doing wrong?
yfleury Active Member Licensed User Longtime User Jul 21, 2022 #4 Ok I see and can choose the json file. But the event raise with this in log B4X: Copy true - ContentDir - content://com.android.providers.downloads.documents/document/msf%3A5642 I have choose 2 time the json file to raise event My event sub B4X: Copy public Sub boiteDialog_Result (Success As Boolean, Dir As String, FileName As String) Log(Success & " - " & Dir & " - " & FileName) Bornes_fontaines(Dir, FileName) I use this to open a json file B4X: Copy Public Sub Bornes_fontaines(dossier As String, nomfichier As String) Dim json As String json = File.ReadString(dossier, nomfichier) ' Log (json) Dim parser As JSONParser parser.Initialize(json) But I have result for json importation data Upvote 0
Ok I see and can choose the json file. But the event raise with this in log B4X: Copy true - ContentDir - content://com.android.providers.downloads.documents/document/msf%3A5642 I have choose 2 time the json file to raise event My event sub B4X: Copy public Sub boiteDialog_Result (Success As Boolean, Dir As String, FileName As String) Log(Success & " - " & Dir & " - " & FileName) Bornes_fontaines(Dir, FileName) I use this to open a json file B4X: Copy Public Sub Bornes_fontaines(dossier As String, nomfichier As String) Dim json As String json = File.ReadString(dossier, nomfichier) ' Log (json) Dim parser As JSONParser parser.Initialize(json) But I have result for json importation data
drgottjr Expert Licensed User Longtime User Jul 21, 2022 #5 my contentchooser is different from yours. when the result event is fired, i see: true - ContentDir - content://com.android.externalstorage.documents/document/primary%3ADownload%2Ffleury.json and i can open the file, no problem. this is not what you see... your uri is different, although my uri and yours might point to the same place. i'm using sdk30 on android 12 Upvote 0
my contentchooser is different from yours. when the result event is fired, i see: true - ContentDir - content://com.android.externalstorage.documents/document/primary%3ADownload%2Ffleury.json and i can open the file, no problem. this is not what you see... your uri is different, although my uri and yours might point to the same place. i'm using sdk30 on android 12
yfleury Active Member Licensed User Longtime User Jul 21, 2022 #6 B4X: Copy <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="30"/> Upvote 0
yfleury Active Member Licensed User Longtime User Jul 21, 2022 #7 B4X: Copy public Sub boiteDialog_Result (Success As Boolean, Dir As String, FileName As String) Log(Success & " - " & Dir & " - " & FileName) 'Bornes_fontaines(Dir, FileName) Dim texte As String texte= File.ReadString(Dir, FileName) Log(texte) When I run that, I read the file. Upvote 0
B4X: Copy public Sub boiteDialog_Result (Success As Boolean, Dir As String, FileName As String) Log(Success & " - " & Dir & " - " & FileName) 'Bornes_fontaines(Dir, FileName) Dim texte As String texte= File.ReadString(Dir, FileName) Log(texte) When I run that, I read the file.