Greetings,
I love the CustomGallery but ran into a snag the first time using it. I'm having difficulties loading existing photos into a gallery I initialized. Here is what I have done so far.
I added a panel inside another existing panel other programmers defined. Please see the attachment. It's called PanelImagePicker and it's parent is Panel_Gallery.
This is the gallery declaration in the Globals sub routine.
This is the code I used to initialize the gallery
This is the code I used to try and load images into the gallery. No errors are reported on the screen or in the logs.
The commented out code was just to make sure the code is really finding the images and that works since I can see the images as the for loop executes.
When the code finishes execution, I don't see any images in the gallery which is mapped to PanelImagePicker.
All help on this will really be appreciated.
Thanks.
I love the CustomGallery but ran into a snag the first time using it. I'm having difficulties loading existing photos into a gallery I initialized. Here is what I have done so far.
I added a panel inside another existing panel other programmers defined. Please see the attachment. It's called PanelImagePicker and it's parent is Panel_Gallery.
This is the gallery declaration in the Globals sub routine.
B4X:
Private TheGallery As ClsCustomGallery
End Sub
This is the code I used to initialize the gallery
B4X:
Sub InitializeObjects
strShared = Starter.rp.GetSafeDirDefaultExternal("Settings")
PanelImagePicker.Initialize("")
' This is for the KeyValueStore database. It stores a Key and a value.
'---------------------------------------------------------------------
kvs.Initialize(strShared, "Settings")
' This is to initialize a gallery for the image picker.
'------------------------------------------------------
TheGallery.Initialize(PanelImagePicker, 0, 0, 100%x, 100%y, 6, Me, "", "Gallery_onClick", "Gallery_onLongClick", "")
End Sub
This is the code I used to try and load images into the gallery. No errors are reported on the screen or in the logs.
B4X:
' Load the image picker with images.
'-----------------------------------
For i = 1 To 18
Dim theBitmap As Bitmap
If File.Exists(GetExternalStoragePublicDirectory("DCIM") & _
"/Camera", "Synventive" & i & ".jpg") Then
theBitmap = LoadBitmap(GetExternalStoragePublicDirectory("DCIM") & _
"/Camera", "Synventive" & i & ".jpg")
TheGallery.AddThumbnail(theBitmap, i)
' MoldMapView.SetBackgroundImage(theBitmap)
Else
Log("The file number " & i & " is not there.")
End If
Next
The commented out code was just to make sure the code is really finding the images and that works since I can see the images as the for loop executes.
When the code finishes execution, I don't see any images in the gallery which is mapped to PanelImagePicker.
All help on this will really be appreciated.
Thanks.