Android Question Dialogs & Images

goron

Member
Licensed User
Dialogs & Images

I would like to show the selected image ( .png .jpg - etc ) as "ICON"
as can be seen below :
Dim ICON As Bitmap
Icon.Initialize(File.DirAssets, "android48.png")
Dim Action As Int = FileDialog1.Show("Select a file:", "OK", "Cancel", "", ICON)

When the textbox shows its name (file name), and before (OK, Cancel) button is pressed.
Replacing the ICON with the updated image, or create another view for it.

TIA,
Gideon
 

goron

Member
Licensed User
I thought a small change (Dialogs lib v2.94) is needed to show the selected image.
FileExplorer v21 is quite "heavy" for this task and uses:
Animation lib
Reflection lib
ScrollView2D lib

10x !, Gideon
 

goron

Member
Licensed User
Thanks Ivan,

I found Treeview Class (Tree and Node) written by Derez works fine with the minimal change! (In blue)
Now, I can see the image before it selected!

Just in case anyone is interested:

Main:
'here if you want to put the specific icon of the file as a bitmap,
'create a map of all file extensions and their icons, then check the extension of st and set : da.imgflag = 4 : da.bmp = [icon]
Da.imgflag = tr.FILE_IMG
Da.imgdir = dir
Da.imgfile = st

Log(dir & " : " & st) ' just 4 test

Tree module:
Case FILE_IMG ' =2
tbmp = fileimg
If Da.imgfile.EndsWith(".jpg") OR Da.imgfile.EndsWith(".png") Then
tbmp = LoadBitmap(Da.imgdir,Da.imgfile)
End If
 

ivan.tellez

Active Member
Licensed User
I found Treeview Class
Its actually easier, with the standard ListView.

B4X:
Private bfile_pic As Bitmap
Private ListFiles As ListView

'Initialize the icons
bfile_pic.Initialize(File.DirAssets, "file_pic.png")


'Then, use the icons
ListFiles.AddTwoLinesAndBitmap2("File Name", "File Type", FileIco, "File Name")
 

Informatix

Expert
Licensed User
I thought a small change (Dialogs lib v2.94) is needed to show the selected image.
FileExplorer v21 is quite "heavy" for this task and uses:
Animation lib
Reflection lib
ScrollView2D lib

10x !, Gideon
The three libraries total up 60 kb so I'm not sure to understand the argument here.
 
Top