Code example for EditText

Methods: getTextgetSelectionEndgetSelectionStart

0
		if(ke.getAction() == KeyEvent.ACTION_DOWN){
			if(ke.getKeyCode() == KeyEvent.KEYCODE_ENTER || ke.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER){
				return InlineAutoCompleterDynamic.this.onEnter();
			}else if(ke.getKeyCode() == KeyEvent.KEYCODE_CLEAR || ke.getKeyCode() == KeyEvent.KEYCODE_DEL){
				final EditText et = InlineAutoCompleterDynamic.this.mEditText;
				final int selStart = et.getSelectionStart();
				final int selEnd = et.getSelectionEnd();
				if(selStart != selEnd){
					et.getText().delete(selStart, selEnd);
					return true; 
				} 
			} 
		} 
		return false; 
	} 
 
	@Override 
	public void afterTextChanged(final Editable s) { }
 
	@Override 
	public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after){ }