[Solved] How to equal button text with the addition of two button text


Your code looks right, I think. Maybe you could try the following:

String btn12 = button1Text + button2Text;
if(btn12.equals(button3Text)) {
    return true;
}

For debug purposes you could log buttonText1, buttonText2, buttonText3 and the concat string btn12. Do they really have the same content?

Update:

Ahh okay the strings contains numbers and you want to add the numbers. Then try the following:

String button1Text = "1";
        String button2Text = "2";
        String button3Text = "3";
        String number = String.valueOf(Integer.parseInt(button1Text) + Integer.parseInt(button2Text));

        if(number.equals(button3Text)) {
            Log.d("debug", "it's true");
        }

You have to cast the strings to integers first. Then you can add the numbers and convert back into string. Or you convert buttonText3 to int too and then compare both values with

if((number1 + number2) == number3)

2

solved How to equal button text with the addition of two button text