Possible Duplicate:
Validations in android/eclipse
I've seen this other post but the top answer only works for TextView
s defined in the manifest file, which is not my case. I'm using a DialogAlert
object to ask for a String, which can only be alphanumeric.
[UPDATE]
final EditText input = new EditText(MainActivityS.this);
setUserIdAlertDialog.setView(input);
setUserIdAlertDialog.setPositiveButton(getString(R.string.yesLabel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString();
Utils.sendStringIntent(getBaseContext(), getString(R.string.ACTION_ACTIVITY_NEW_ID), "ACTIVITY", value, getString(R.string.INTENT_EXTRA_NEW_USERNAME));
}
});
setUserIdAlertDialog.setNegativeButton(getString(R.string.noLabel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
setUserIdAlertDialog.show();