viernes, 4 de julio de 2014

Android: Hide keyboard

1) Hide keyboard

private void hideKeyboard() {

EditText calibationEditText = (EditText) findViewById(R.id.calibration);

InputMethodManager imm = (InputMethodManager) 
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(calibationEditText.getWindowToken(), 0);

calibationEditText.clearFocus();
}

2) I created a dialog with an EditText when I close the dialog the keyboard doesn't disappear, it only changed from input type number to normal.

AndroidManifest.xml

<activity
            android:name="ar.com.fennoma.digipad.activities.Activity"
            android:label="@string/app_name"
            android:windowSoftInputMode="stateAlwaysHidden" >
</activity>

Activity is the activity that creates the dialog.

No hay comentarios:

Publicar un comentario