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...
www.b4x.com
In the Sub ListView1_ItemClick there is this code fragment with a comment that I cannot see a reason for.
B4X:
Private Sub ListView1_ItemClick (Position As Int, Value As Object)
Dim f As ExternalFile = Value
If f = UpItem Then
'....
Else
'The ExternalFile returned from ListFiles cannot be used directly.
'We need to first call FindFile.
f = Storage.FindFile(GetCurrentFolder, f.Name)
' ''''
End If
End Sub
Is/was there a reason for not using the ExternalFile instance from ListFiles as it seems to work fine in my testing so far.
Something just popped up from the depths of my memory about this. There was a bug in the original ExternalStorage class that I had a hard time convincing Erel was actually there. It resulted in all the ExternalFile instances in ListFiles having their Native fields pointing to the same JavaObject. See post#15 here
I need to find a known file in a known folder on the external SD Card and display it in an image viewer. Ghost commander can do this apparently using both the old file:// way and also with Stoarge Access Framework. I am trying to use the ExternalStorage class but it is not behaving as I expect...
www.b4x.com
Perhaps Erel added the FindFile call to the example to overcome this bug which made the ExternalFile instances in ListFiles unusable and was eventually fixed.
Perhaps Erel added the FindFile call to the example to overcome this bug which made the ExternalFile instances in ListFiles unusable and was eventually fixed.