Code example for Editable

Methods: length, setSelection

0
 
	public void setTextAndFocus(String text, boolean start) {
		setText(text);
		Editable editable = mEditText.getText();
		if (!start) {
			Selection.setSelection(editable, editable.length());
		} else { 
			Selection.setSelection(editable, 0);
		} 
		mEditText.requestFocus();
	} 
 
	public void setText(String text) {
		mEditText.setText(text);
		updateCharsRemain(); 
	} 
 
	private TextWatcher mTextWatcher = new TextWatcher() {
		@Override 
		public void afterTextChanged(Editable e) { 
			updateCharsRemain();