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