I am using the SimpleMediaManager to show images from a webpage as per the example from Erel. I store the name of the image in the tag property of the label. When the label is clicked, a larger version of the image is displayed in a second window. When the images are ready and I click on an image, it is displayed with zoom etc. Then closing the window and clicking a second image, the first image is still shown. I have checked "Main.MainImage" and it has the correct filename. Any help please?
B4XMainPage:
'The calling sub '
Private Sub Label_MouseClicked (EventData As MouseEvent)
Dim lbl As Label
lbl=Sender
'main picture is in "cover" not "t_cover"
Main.MainImage=lbl.Tag
Main.MainImage=Main.MainImage.Replace("t_cover", "cover")
Log("opening: " & Main.MainImage)
'Show the second page with the large image
B4XPages.ShowPage("LargeImage")
End Sub
DisplayLargeImage:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private Pane1 As B4XView
Private MediaManager As SimpleMediaManager
End Sub
'You can add more parameters here.
Public Sub Initialize As Object
Return Me
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("ImagePane")
MediaManager.Initialize
MediaManager.MaxMediaCacheSize = 0
MediaManager.ClearMedia(Pane1) 'clear old image
MediaManager.TrimMediaCache 'remove image from cahe
MediaManager.SetMediaWithExtra(Pane1, Main.MainImage, "", CreateMap(MediaManager.REQUEST_ZOOMIMAGEVIEW: True))
B4XPages.SetTitle(Me, "Large Image")
End Sub