vendredi 21 août 2020

Android java compare xml string with edittext

I want to compare a xml string with a string from an edittext oder button. first I set the text of the button:

button1.setText(getString(R.string.okey));

and now I want to check if the text from the button is the same as R.string.okey from the xml file. Like this I can leave out a new variable.

Is it possible to check if the strings are the same with something like this?

if (button1.getText().toString().equals(getString(R.string.okey))){
}

But that doesn't work for me.

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire