[android] Disabling of EditText in Android

Try this one, works fine for me:

public class CustomEdittext extends EditText {

Boolean mIsTextEditor=true;
public CustomEdittext(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
}

@Override
public boolean onCheckIsTextEditor() {
    // TODO Auto-generated method stub
    return mIsTextEditor;
}


@Override
public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    mIsTextEditor=false;
    Boolean mOnTouchEvent=super.onTouchEvent(event);
    mIsTextEditor=true;     
    return mOnTouchEvent;
} }

Note: You need to add this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); on your activity or else keyboard will popup at first time.