Android Question Error : java.io.FileNotFoundException: /storage/......

ciginfo

Well-Known Member
Licensed User
Longtime User
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
 

JohnC

Expert
Licensed User
Longtime User
Try adding this to the manifest:

B4X:
SetApplicationAttribute(android:requestLegacyExternalStorage, true)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
File.WriteList(File.DirRootExternal,FileSETTINGS,Settings)
android.jar / targetSdkVersion / minSdkVersion

Especially RuntimePermissions

To Access External Storages you need to use
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
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 ?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
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:


 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
Hello,
Now it runs with DirInternal,
B4X:
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)
 
Upvote 0
Top