How to disable edittext in android

Approach 1:


In code:
editText.setEnabled(false);
Or, in XML:
android:editable="false"

Approach 2:


edittext.setFocusable(false); 
edittext.setEnabled(false);

InputMethodManager imm = (InputMethodManager)
  getSystemService(Context.INPUT_METHOD_SERVICE);

imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0);
  //removes on screen keyboard

Comments

Popular posts from this blog

How to draw an overlay on a SurfaceView used by Camera on Android?

Android TCP Connection Chat application

Create EditText with dropdown in android