Android Question App stopping on click

Erfan Kakaei

New Member
Hello,
I was wondering if anyone could help me with this.
My app compiles just fine, but when I click on any button within it, it just stops and exits.
P.S: The only code within the mentioned buttons is to change the text inside a label.
As in:
B4X:
label.Text = "1"
 

mangojack

Well-Known Member
Licensed User
I will take a wild shot ... Should the above code be Label1.Text = "1"

If this does not solve you problem ... follow @DonManfred instructions so we can help you further .
 

DonManfred

Expert
Licensed User
Well unfortunately I don't have access to the logs
Connect your device with usb and use USB Debugging. It will list the log.
The Error is "Empty String" in a math calculation
In fact it is this code from you.
B4X:
        lblSum.Text = lblSum.Text + "0"
lblSum is empty at start. You are trying to do a math operation here.
add 0 to lblSum.Text.

To concat the value of lblSum.Text and the 0 (when pressing Button "1" seems wrong to me.
B4X:
        lblSum.Text = lblSum.Text & "0"
This was the case in all buttons.

Please find a slightly changes example.
i have changed
- all occurances of
B4X:
lblSum.Text = lblSum.Text + "0"
with
B4X:
lblSum.Text = lblSum.Text & "0"
to concat the String.
- all other numberbuttons other than the 0 to match the right number. You did used 0 in all...
 

Attachments

Erfan Kakaei

New Member
Thank you very much sir, it's been solved.
Now could you please tell me how I can set a number variable to Null?
For example let's say there's an integer with the value 4 inside it, and i'd like to have it empty as if it was just created.
And is the method the same as setting a string to Null?
 
Top