ImageView not showing image

alvinmb

Member
Licensed User
Longtime User
I have an imageview and I want to change the image that is displayed depending on if I have a wifi connection or not. My images are accessible and I don't get any errors in the log. However all I see is a blank box where the image should be. If I assign one of the images in the designer, then I never get a changed image when I loose Wifi. What am I doing wrong?

All the code is in this one sub. The imageView is called wifi_access


B4X:
Sub Check_WIFI

      wifi_access.Initialize("wifi_access")

   If Mylan.GetMyIP = "127.0.0.1" Then
       Log( "We have lost WIFI access")
      WIFI_Status = 0
      wifi_access.Gravity = Gravity.FILL
      wifi_access.Bitmap = LoadBitmap(File.DirAssets,"!Wi-Fi.png")
      wifi_access.BringToFront
      wifi_access.Invalidate
   Else
      WIFI_Status = 1
      Log("We have WIFI connection")
      wifi_access.Gravity = Gravity.FILL
      wifi_access.Bitmap = LoadBitmap(File.DirAssets,"Wi-Fi-32.png")
      wifi_access.BringToFront
      wifi_access.Invalidate
   End If

End Sub
 

splatt

Active Member
Licensed User
Longtime User
B4X:
 wifi_access.Initialize("wifi_access")

If this ImageView is loaded with a layout created in the designer, then I think you can comment this out.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…