Hy guys,
it happened this error but I can't find the reason. Please have a look at this piece of code ( paste here the essential):
B4X:
Sub Globals
Dim Icon As BitmapDrawable
End Sub
Sub GPS_LocationChanged (Location1 As Location)
Dim geopoint1 As GeoPoint
geopoint1.Initialize(Location1.Latitude,Location1.Longitude)
Move_Marker("Marker_gps",geopoint1,"iconcar.png")
End Sub
Sub Move_Marker(MarkerId As String, geopoint1 As GeoPoint, icn As String)
Icon.Initialize(LoadBitmap(File.DirAssets, icn))
etc
etc
etc
End Sub
So, GPS_LocationChanged call Move_Marker and the line Icon.Initialize has generated the exception.
Of course "iconcar.png" exist, the program runs normally all time long, but once has happened that exception. I'm interested to understand why, if there is an answer ...
Thanks
Marco
It would have been better to declare the variable as process global variable instead of global. I'm not 100% sure which error did you get and why it happened. If it happens again please post the full error message from the logs.
Global variables are not available when the activity is paused. This is why you should declared all non-view related variables as process_global variables.
Understand, thank you, I will do that.
But that is a view related variable ... this code runs fine since several months. I'm curious to understand why I noted that error just once. If it is not safe to use global variables, I will use process_global variables for all.