UPDATE: When I moved code to "Activity_Create", then it started working. Apparently it is not a good idea to set everything up within a button - it has to be set up outside the button, then you can manipulate the .Visible method. So ignore the below except to learn what NOT to do.
I can display a .png file using ImageView, but I can't get rid of the thing once it is displayed. I have tried everything I can think of. It has to be simple. Please, what am I missing? Thank you.
Why the .Visible command doesn't work is baffling. Same with .Left.
The below code shows some of what I have experimented with - nothing removes the symbols.png graphic.
I can display a .png file using ImageView, but I can't get rid of the thing once it is displayed. I have tried everything I can think of. It has to be simple. Please, what am I missing? Thank you.
Why the .Visible command doesn't work is baffling. Same with .Left.
The below code shows some of what I have experimented with - nothing removes the symbols.png graphic.
B4X:
Dim imv As ImageView
Dim Bitmaps, bmpDot, bmpSymbols As Bitmap
bmpSymbols.Initialize(File.DirAssets,"symbols.png")
bmpDot.Initialize(File.DirAssets,"dot.png")
imv.Initialize("")
If sym_flag = 0 Then
imv.Initialize("")
'imv.SetBackgroundImage(LoadBitmap(File.DirAssets, "symbols.png"))
imv.Bitmap = bmpSymbols
imv.Left = 10
Activity.AddView(imv, 10, 0, 100%x, 100%y)
imv.SetLayout(0, 0, 100%x, 100%y)
imv.Visible = True
sym_flag = 1
Else
imv.Initialize("")
imv.Invalidate
'imv.SetBackgroundImage(LoadBitmap(File.DirAssets, "dot.png"))
imv.Bitmap = bmpDot
imv.Left = 1000
Activity.AddView(imv, 1000, 0, 100%x, 100%y)
imv.SetLayout(1000, 0, 0, 0)
imv.RemoveView
imv.Visible = False
sym_flag = 0
End If
Last edited: