Code example for EditText

Methods: getTextsetTextColor

0
 
		editText.setOnKeyListener(new OnKeyListener() {
 
			@Override 
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (emailIsOk(editText.getText().toString())) {
					setEditTextToNormal(editText);
				} else { 
					setEditTextToError(editText);
				} 
				return false; 
			} 
 
		}); 
 
		editText.setText(load());
 
		container.addView(editText);
		container.setPadding(DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING,
				DEFAULT_PADDING); 
 
		return container;
	} 
 
	private void setEditTextToError(EditText editText) {
		editText.setTextColor(Color.argb(255, 255, 0, 0));
	} 
 
	private void setEditTextToNormal(EditText editText) {
		editText.setTextColor(originalEditTextColor);
	} 
 
	final Pattern EMAIL_ADDRESS_PATTERN = Pattern
			.compile("[^@ ]+[@][^@ ]+[.][^@ ]+");