Android Question Check for NULL [Suspended]

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

Is there a way to check for a NULL in the code below. If I can test for Null I can work around the problem and determine why I get the Null. [I think its me]
At best this problem is pretty random so I don't think I can make a demo.

I have found ways that are supposed to check for Null but not exactly the same situation and therefore they don't work
I have tried "If X = Null then" but throws a Null Error rather that follow the code.
I have tried making X an Object, same result.

B4X:
         Private Results(16,5,2)    As String
        Private Results2 (,,) As String
        Results2  = kvs.GetObject("Results")

    'Reload "Results" array from Results2
        For FNM = 0 To 15
            For STEPS = 0 To 4
                For DATA2 = 0 To 1
                    Results(FNM,STEPS,DATA2) = Results2(FNM,STEPS,DATA2)
                Next
            Next
        Next


Any suggestions welcome.
Regards Roger
 

Roger Daley

Well-Known Member
Licensed User
Longtime User
Is the kvs is an object? Can try to check for is initialized?
if kvs.isInitialized
The KVS stores a number of Lists and a number of Arrays of Strings. The problem crops up randomly but appears only to be Arrays, the Lists are read before the Arrays so the KVS does not appear to be the issue.
A method of testing for a Null would be useful in a number of situations.

Thanks for the response.

Regards Roger
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Around 24hrs ago Erel made the suggestion above. I inserted the code below and similar lines for each Array in the KVS.

B4X:
If kvs.GetObject("Results") = Null Then ToastMessageShow("Results is Null",True)

For 24Hrs I have been stopping, starting and reinstalling the App. No sign of the error/crash I had been experiencing for two days.
I am pretty sure Erel hadn't intended that code to fix the problem but it's either that or the software Gremlins.

I will suspend the thread until if and when the problem returns.

Many Thanks to all for the feedback.

Regards Roger
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
For 24Hrs I have been stopping, starting and reinstalling the App. No sign of the error/crash I had been experiencing for two days.
I am pretty sure Erel hadn't intended that code to fix the problem but it's either that or the software Gremlins.

I will suspend the thread until if and when the problem returns.

Many Thanks to all for the feedback.
Italian way of saying:
"L'occhio del padrone ingrassa il cavallo"
"The master's eye makes the horse fat".

Sometimes it is enough that Erel reads the post in which you describe the problem and the problem is solved šŸ˜„ (it happened to me!)
 
Upvote 0
Top