Wish ImageSlider and SimplemediaManager

MarcoRome

Expert
Licensed User
Longtime User
Hi All.
A few years ago, this excellent class was developed that performed a slider on photos.

It would be very interesting to be able to use the simple media manager within the same device so as to be able to view not only images but possibly also videos, etc.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Switch to B4XPages.
2. Use this code:
B4X:
Sub ImageSlider1_GetImage (Index As Int) As ResumableSub
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated(0, 0, 0, ImageSlider1.WindowBase.Width, ImageSlider1.WindowBase.Height)
    'change to smm.SetMedia for online images.
    smm.SetMediaFromFile(pnl, File.DirAssets, $"test_${Index + 1}.jpg"$, "image/jpeg", CreateMap(smm.REQUEST_CALLBACK: Me))
    Wait For (pnl) SMM_MediaReady (Success As Boolean, Media As SMMedia)
    If Success Then
        Return Media.Media.As(B4XBitmap)
    Else
        'return error image
    End If
End Sub
You will see a warning in the logs "Target is not in the views tree!". Ignore it.
 

Attachments

  • Project.zip
    239.6 KB · Views: 23
Top