I have EditText which displays something like ###-###. I want the user to be able to change this text only from the 1st position onward. That is user should not be able to touch
try creating a class the derives from edittext and override onSelectionChanged for example
public class BlockedSelectionEditText extends
EditText{
/** Standard Constructors */
public BlockedSelectionEditText (Context context) {
super(context);
}
public BlockedSelectionEditText (Context context,
AttributeSet attrs) {
super(context, attrs);
}
public BlockedSelectionEditText (Context context,
AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
//on selection move cursor to end of text
setSelection(this.length());
}
}