Hi all,
I manage to retrieve an imagelist from a folder on the sdcard and
getting displayed on a scrollview.
But I'm having trouble with getting an imagelist from subfolders.
This is what I have:
Note: it's within a customdialog.
After that, it should appear to a scrollview with this code:
Too bad, it didn't work.
Anyone having a solution for this?
I manage to retrieve an imagelist from a folder on the sdcard and
getting displayed on a scrollview.
But I'm having trouble with getting an imagelist from subfolders.
This is what I have:
B4X:
Sub btAuto_Click 'ListFiles (Dir As String) As List
f = File.ListFiles(File.DirRootExternal & "/Upload/Auto/")
StartActivity("results")
End Sub
Sub btMotor_Click
f = File.ListFiles(File.DirRootExternal & "/Upload/Motor/")
StartActivity("results")
End Sub
After that, it should appear to a scrollview with this code:
B4X:
Sub LoadImages
Bitmaps.Initialize
Dim files As List
Dim imageFolder As String
imageFolder = File.DirRootExternal & "/Upload/" & "Auto/" & "Motor/"
If File.Exists(imageFolder, "") = False Then
ToastMessageShow("Images not found:" & CRLF & imageFolder, True)
Return
End If
files = File.ListFiles(imageFolder)
For i = 0 To files.Size - 1
DoEvents
Dim f As String
f = files.Get(i)
If f.ToLowerCase.EndsWith(".jpg") Then
Dim b As Bitmap
b.InitializeSample(imageFolder, f, 300dip, 300dip)
Bitmaps.Add(b)
If Bitmaps.Size > 50 Then Exit
End If
Next
ToastMessageShow(Bitmaps.Size & " found", False)
End Sub
Too bad, it didn't work.
Anyone having a solution for this?