Android Question Null - problem

gigi0ne

Member
Licensed User
Longtime User
I have a problem with a null,
when I check it is not detected.

Any ideas?

Below there is a capture screen.
Thank you

Screenshot from 2022-08-22 18-03-42.png

A
 
Last edited:
Solution
so NewsA looks like a map of some sort. and my guess would be that
NewsA.Link is a string, yes?

primitive data types can't be null. a string is one such data type,
although its value can be the null string (often seen as null - essentially "null" without
quotes, which is not the same thing as the null type).

null (the null type) isn't really a value. if you see null as a value, it is often a null (empty) string. you almost never
see "null" with the quotes, but rather simply null, which makes people think it's
null, which it isn't.

you might want to test NewsA. it could be null, and its properties affected
accordingly. or there simply could, in fact, be no NewsA.Link. if only
NewsA.Link is of interest, try testing for "" or...

drgottjr

Expert
Licensed User
Longtime User
so NewsA looks like a map of some sort. and my guess would be that
NewsA.Link is a string, yes?

primitive data types can't be null. a string is one such data type,
although its value can be the null string (often seen as null - essentially "null" without
quotes, which is not the same thing as the null type).

null (the null type) isn't really a value. if you see null as a value, it is often a null (empty) string. you almost never
see "null" with the quotes, but rather simply null, which makes people think it's
null, which it isn't.

you might want to test NewsA. it could be null, and its properties affected
accordingly. or there simply could, in fact, be no NewsA.Link. if only
NewsA.Link is of interest, try testing for "" or "null".

if NewsA.Link is not a string, then i apologize for wasting your time.
 
Upvote 1
Solution

asales

Expert
Licensed User
Longtime User
try with this:
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
primitive data types can't be null. a string is one such data type,
To be pedantic strings are not actually primitive types but are reference types with value semantics and they can be null though B4X tries to avoid it. I know of two instances where this can happen. One is if a library returns a null value as a string parameter, I don't think B4X currently checks for this, and the other is a string item in an uninitialized custom type.
 
Last edited:
Upvote 0

gigi0ne

Member
Licensed User
Longtime User
so NewsA looks like a map of some sort. and my guess would be that
NewsA.Link is a string, yes?

primitive data types can't be null. a string is one such data type,
although its value can be the null string (often seen as null - essentially "null" without
quotes, which is not the same thing as the null type).

null (the null type) isn't really a value. if you see null as a value, it is often a null (empty) string. you almost never
see "null" with the quotes, but rather simply null, which makes people think it's
null, which it isn't.

you might want to test NewsA. it could be null, and its properties affected
accordingly. or there simply could, in fact, be no NewsA.Link. if only
NewsA.Link is of interest, try testing for "" or "null".

if NewsA.Link is not a string, then i apologize for wasting your time.

Thanks for the replies.

Fixed with drgottjr's solution
 
Upvote 0
Top