Hello,
I don't understant why I obtain this error : java.io.FileNotFoundException: /storage/3064-3162 (Is a directory)
In the Manifest Editor, I have:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
An idea?
Thank you
B4X:
Sub Globals
Dim MySet1, MySet2 As Double
Dim FileSETTINGS As String
End Sub
Sub SAUVE_Click
Dim Settings As List
Settings.Initialize
MySet1 = 100
MySet2 = 200
Settings.Add(MySet1)
Settings.Add(MySet2)
File.WriteList(File.DirRootExternal,FileSETTINGS,Settings)
End Sub
Before we start: External storage means a real sd card or a connected mass storage USB device. This class can also be used to access the secondary storage (File.DirRootExternal). This becomes relevant with newer versions of Android that restrict direct access. It has nothing to do with runtime...
Have I to write
File.WriteList(File.DirDefaultExternal,FileSETTINGS,Settings)
even if there is an external storage as à SD card ? Or i 'm following a bad track ?
If the reason you are trying to save the settings to external memory is because you want to "export" your settings so the user can copy them elsewhere (cloud), then you can do that using the File Provider method:
Edit: FileProvider is included as an internal library now. After investigating several issues with the current FileProvider code that you can find in the forum, I decided to make some improvements and implement it in a class. Starting from Android 7 (API 24) you cannot directly share file uris...
Example was updated based on FileProvider class: https://www.b4x.com/android/forum/threads/class-fileprovider-share-files.97865/ See the above link if you are interested in sharing files from your app. This tutorial explains the steps required to implement a file picker that other applications...
Sub SAUVE_Param_Click
Dim Settings As List
Dim MySet1, MySet2 as Double
Settings.Initialize
MySet1 = 100
MySet2 = 200
Settings.Add(MySet1)
Settings.Add(MySet2)
File.WriteList(File.DirInternal,FileSETTINGS,Settings)
End Sub
But I cannot recover data : Error java.io.FileNotFoundException: /data/user/0/ciginfo.Join_Me_New/files (Is a directory)
B4X:
Sub LOAD_Param
Dim List1 As List
Dim MySet1, MySet2 As Double
If File.Exists(File.DirInternal,FileSETTINGS) Then
List1 = File.ReadList(File.DirInternal,FileSETTINGS)
MySet1 = Location.Get(0)
MySet2 = Location.Get(1)
'Affiche
LblSet1.Text = MySet1
LblSet2.Text = MySet2
End If
End Sub
Error With This line : List1 = File.ReadList(File.DirInternal,FileSETTINGS)