I have a problem, I have an EditText element (input type is numbers only), and I am trying to check if the value is null when pressing a button.
My code:
// Get the chosen number input
EditText numberInput = (EditText) findViewById(R.id.numberPlainTextInput);
int chosenNumber = Integer.parseInt(numberInput.getText().toString().trim());
// Get the result text element to set it`s text
TextView resultText = (TextView) findViewById(R.id.resultText);
// If input number field is not null
if (**@number is not null@**) { **@Do something here@** }
I know how to do it on PHP but I am new to Java. Thanks in advance!
Use TextUtils.isEmpty(numberInput.getText());