Wednesday, April 6, 2011

How to validate a textfield in Android

Determining the value of a text field string in Android is very easy. At first, I was making this much more complicated than it actually is. See below:

EditText myEdit;

myEdit = (EditText) findViewById(R.id.edit1);

if (myEdit.getText().equals("Text to search for")) {

// whatever you want it to do

}

No comments:

Post a Comment