Android Question CustomGallery - Photos are not loading into the gallery


Well-Known Member
Licensed User
Longtime User

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.

    Private TheGallery As ClsCustomGallery
End Sub

This is the code I used to initialize the gallery

Sub InitializeObjects
    strShared = Starter.rp.GetSafeDirDefaultExternal("Settings")
    ' 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.

    ' 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)
            Log("The file number " & i & " is not there.")
        End If

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.



  • Screenshot 2019-12-17 at 15.08.49.png
    Screenshot 2019-12-17 at 15.08.49.png
    173.8 KB · Views: 273