Servaas Member Licensed User Mar 17, 2017 #1 Trying to change a Imageview upon clicking but this does not seem to do anything, do I need to load the .png files first? Code: Copy If Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molealive.png") Then Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molehit.png") Else Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molealive.png") End If
Trying to change a Imageview upon clicking but this does not seem to do anything, do I need to load the .png files first? Code: Copy If Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molealive.png") Then Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molehit.png") Else Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molealive.png") End If
mangojack Expert Licensed User Longtime User Mar 17, 2017 #2 Use the Tag property to store the loaded image ... Gopher1.Tag = "molealive" Then .. Code: Copy If Gopher1.Tag = "molealive" Then Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molehit.png") Gopher1.Tag = "molehit" Else Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molealive.png") Gopher1.Tag = "molealive" End If If you are constantly swapping / loading images it might be an idea to load the images to variable bitmaps once at app start then use them in your ImageView. Last edited: Mar 17, 2017 Upvote 0
Use the Tag property to store the loaded image ... Gopher1.Tag = "molealive" Then .. Code: Copy If Gopher1.Tag = "molealive" Then Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molehit.png") Gopher1.Tag = "molehit" Else Gopher1.Bitmap = LoadBitmap(File.DirAssets, "molealive.png") Gopher1.Tag = "molealive" End If If you are constantly swapping / loading images it might be an idea to load the images to variable bitmaps once at app start then use them in your ImageView.