Simple Calculator Project (Android App)


project asks to

Ensuring the app doesn’t crash when the equals button is pressed and one of the number boxes is empty.

  • When equals is pressed, before you do anything, ensure that the number boxes aren’t empty so an error doesn’t throw.

How to check whether is it something in number boxes?

Hi, and welcome to the forums :slight_smile:

If this is how you get the value from the numberBox:


…then you’d just need to check whether that equals "" (an empty String) or not.
Something like this:

if(numberBox.getText().toString() == ""){
    // do something
    // do something else

Hope this helped :slight_smile:

1 Like

I had to use