How can I check if an object is empty (Uri)?? I am not able to do it. I tried it with this code but the if query doesn´t work and the "Cursor.Position = 0" returns an error for the cases that I pressed the return button and the Uri variable is empty.
B4X:
Dim Uri As Object
Uri = r.RunStaticMethod("android.net.Uri", "parse", _
Array As Object(UriString), _
Array As String("java.lang.String"))
If Uri <> Null Then '<< THIS DOESN´T WORK
Cursor.Position = 0
Dim res As String
res = Cursor.GetString("_data")
Cursor.Close
Return res
End If
Yes I know.
Therefore i put the if statement afterwards to stop executing the rest of the procedure but the if statement doesn´t work and therefore I get an error.
That is not the same as Null. Null means no value, an empty string assigned to a variable then means that it isn't Null, as it has a value, even if that string doesn't have a length.
So null means no value and hasn't had a value.
assigning "" to a string means it hasn't got a length, but it's not null either.
That is not the same as Null. Null means no value, an empty string assigned to a variable then means that it isn't Null, as it has a value, even if that string doesn't have a length.
So null means no value and hasn't had a value.
assigning "" to a string means it hasn't got a length, but it's not null either.