Omar Abdelhafiz Omar Abdelhafiz - 5 months ago 13
Android Question

Android Java How to jump to a certain line

I want to skip the return if (firstAns.getText() != null) but there is no goto in java.

Please help and be simple.

Thanks!!!

EditText firstAns = (EditText) findViewById(R.id.first_ans);

if (firstAns.getText() != null) {
//I want to skip the return or jump down below it
}
return;

Answer

If you want to skip the return like that, then I assume you want to return when firstAns.getText() == null

EditText firstAns = (EditText) findViewById(R.id.first_ans);

if (firstAns.getText() == null) return;

// rest of your code
Comments