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"
 

DonManfred

Expert
Licensed User
Longtime User
it just stops and exits
Check the log and post the full error. Without it is hard to give any advice.

If you have a small testproject. Upload it. In the IDE use File->Export as zip and upload this zip.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime 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 .
 
Upvote 0

Erfan Kakaei

New Member
Check the log and post the full error. Without it is hard to give any advice.

If you have a small testproject. Upload it. In the IDE use File->Export as zip and upload this zip.
Well unfortunately I don't have access to the logs, but yes my project is small.
Here it is:
 

Attachments

  • Calculator.zip
    10.3 KB · Views: 271
Upvote 0

DonManfred

Expert
Licensed User
Longtime 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

  • calcnew.zip
    10.4 KB · Views: 247
Upvote 0

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?
 
Upvote 0
Top