Android Question How to replace the null value of a label

Daniel44

Active Member
Licensed User
Hey everyone!

Im storing inside a map some double values... but when that values inside the map are null and I want to show in a label.text = 0,00 it shows me null... I mean If my map.size = 0 I need to show 0,00 on the label.text and I can't change that text

Here's my map

B4X:
account = parser.NextArray
    For i = 0 To account.Size - 1
    Dim m As Map
    m = account.Get(i)
If m.Size = 0 Then
LblValues.Text = "0,00 "

on my my devece lblValues shows me: null and I need it shows me 0,00

I've changed it to '00,0' then to 0 then to '0' I also created a varible to assign to the label with a 0,00 value but nothing happens.. it just still showing null. Thank you
 

Daniel44

Active Member
Licensed User
You probably can condense your sub to this:
B4X:
Sub NumberFromDatabaseField(field As String) As String
    Dim strField As String = field.Trim
    If Not (IsNumber(strField)) Then Return "0" 'or "0.00" as desired in this thread
    Return strField
End Sub
Mahares thank you for answering yes it look useful I will try to implement this one too thank you
 
Upvote 0
Top