I recently downloaded and ran the GifViewExample sample application that illustrates the use of animated gifs in android apps. The code provided showed how to create
B4XGifView objects but these were placed in a layout and I've been unable to find code on how to place theses objects using code into a panel. The following code examples show my unsuccessful attempts:
First Attempt:
Sub Class_Globals
Dim pnlDownloadCheck As Panel
Dim gifWait As B4XGifView
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlDownloadCheck.Initialize("")
pnlDownloadCheck.Color = Colors.RGB(224, 224, 212) 'Light Yellow
gifWait.SetGif(File.DirAssets, "loading_large.gif")
pnlDownloadCheck.AddView(gifWait, 10, 50, 100, 100) ' **** results in a Types do not match error
End Sub
Second Attempt: (same but using an imgView)
Sub Class_Globals
Dim pnlDownloadCheck As Panel
Dim gifWait As B4XGifView
Dim ivwDownload As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlDownloadCheck.Initialize("")
pnlDownloadCheck.Color = Colors.RGB(224, 224, 212) 'Light Yellow
gifWait.SetGif(File.DirAssets, "loading_large.gif")
ivwDownload.Initialize("ivwDownload")
ivwDownload.Bitmap = gifWait ' **** also results in a Types do not match error
ivwDownload.Gravity = Gravity.FILL
pnlDownloadCheck.AddView(ivwDownload, 10, 50, 100, 100)
End Sub
I imagine that what I want to do is very straightforward. You just need to use the correct view type. Thanks in advance to anyone who can provide the answer!