Android Question what types must be initialized

davepamn

Active Member
Licensed User
Longtime User
I am getting an error that an variable has not been initialized.

Is there a why to know what variables must have an initialize call

var.initialize
 

davepamn

Active Member
Licensed User
Longtime User
Is there an easy way to find the variable that had an initialize method but was not invoked.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Let's say "simple objects" (you call them 'varibles') are DIMed and can be used after that (like DIM v as INT).

Like a screwdriver or a hammer. You can take it and work with it.

If you want to use a chair you have first to build it. This will be done with simple tools like a hammer. Initialize is like an "assemble".
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
Dim connectedDevice As NameAndMac

I found the connectedDevice variable had an initialize, but not invoked. The code did not crash in release mode and I am not sure if this was the code that was crashing. I have added try and catch to isolate the location of the debug crash notification.
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
Sub Process_Globals
Dim connectedDevice As NameAndMac
end sub

serial1.Connect(connectedDevice.Mac)

This code seemed to work without the connectedDevice variable without being initialized.

If connectedDevice.IsInitialized=False Then

connectedDevice.Initialize

End If

When I tried to initialize connectedDevice, it shows already it is initialized. I had to use isInitialized to check the variable state. why?
 
Last edited:
Upvote 0
Top