Use android:windowSoftInputMode="stateAlwaysVisible"
in to AndroidManifest.xml
file
Like this:
<activity android:name=".YourActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysVisible" /> // OR stateVisible
If that activity having EditText
so when ever Activity will start
your Keyboard automatically open
If you want to still open Keyboad
after use done any operation then do this via programetically
InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInputFromWindow(
linearLayout.getApplicationWindowToken(),
InputMethodManager.SHOW_FORCED, 0);
OR
To Show Soft Keyboard
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(EDITABLE_VIEW,
InputMethodManager.SHOW_IMPLICIT);
OR
EDITABLE_VIEW
can be any view which has focus on screen like
mEditText = (EditText) findViewById(R.id.editText);
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mEditText ,
InputMethodManager.SHOW_IMPLICIT);
OR
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInputFromInputMethod(editText.getWindowToken(), 0);
Documentation