Android Question [solved] Flush images in ImageSlider

josejad

Expert
Licensed User
Longtime User
Hi all:

I have a xCustomListView and every item have a horizontal xCustomListView showing images.
When you click in a image (CLVFotos_ItemClick), the sub receives the Index of the image inside the ListView, and a list with the images in the ListView (Value)

B4X:
Sub CLVFotos_ItemClick (Index As Int, Value As Object)
    Log("****** Checklist CLVFotos_ItemClick ********")
    'Index: Index of the image inside the listView
    'Value: List of pics in the ListView
    PanelFotos.Visible = True
    ListOfPictures = Value 'Global variable
    ImageSlider1.NumberOfImages = ListOfPictures.Size
    ImageSlider1.PrevImage
    For i = 0 To Index 
    ImageSlider1.NextImage 'Go to the clicked image as seen in a thread
    Next
End Sub

B4X:
Sub ImageSlider1_GetImage (Index As Int) As ResumableSub
    LblPicName.Text = ListOfPictures.Get(Index)
    Return xui1.LoadBitmapResize(Starter.Folder & "/", ListOfPictures.Get(Index), _
        ImageSlider1.WindowBase.Width, ImageSlider1.WindowBase.Height, True)
End Sub

I have two problems:
1.- When I close the panel showing the Imageslider, and click in another picture in another item of the ListView, I see pictures of the first one, mixed with the new one. I've tried to change the CacheSize to 1, but it's no working.
2.- I show the name of the picture in LblPicName, but I just see the name of the first picture. There's no "slide" event to change the label text?

Thanks in advance
 

josejad

Expert
Licensed User
Longtime User
Thanks for the answer. I saw it when you published it but I didn't connect it with my problem.
Your code is very simple, but I don't get it.
Should I have a different slider for every CustomListView? I just have a panel with a ImageSlider, and I show it when I click in a image.
As I change the pictures in ListOfPictures.Get(Index) I thought It would read the next one in this list...
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
ImageSlider1 is a single imageslider in a panel, and I show it when I press in a CustomListView

When I press in a image in the CustomListView

Screenshot_20181202-162237.png


I turn visible the panel with ImageSlider1, and I change the list of images to show, as you can see in the code above.
screen2.JPG
 
Upvote 0
Top