[ACCEPTED]-OnScreen keyboard opens automatically when Activity starts-scrollview

Accepted answer
Score: 123

Android opens the OnScreenKeyboard automatically 3 if you have an EditText focussed when the Activity 2 starts.

You can prevent that by adding following 1 into your Activity's onCreate method.

 getWindow().setSoftInputMode(
    WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Score: 27

If you want to do it editing the AndroidManifest:

        <activity
        android:name=".Dades"
        android:label="@string/app_name" 
        android:windowSoftInputMode="stateHidden">

the 2 line android:windowSoftInputMode="stateHidden" is the one that prevents the keyboard 1 focus.

Score: 19

Another way is by adding on LinearLayout:

android:focusable="true"

android:focusableInTouchMode="true"

Let 2 me indicate that

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

still does the same thing, but 1 the cursor is still there.

Score: 1

This will an inappropriate behaviour

getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);       

but 2 it will do it smoothly(do it in manifest for that 1 activity)

 android:windowSoftInputMode="stateHidden"
Score: 0

You can use below statement also,

(EditTextName).setInputType(0)

it will 2 permanently hides default keyboard of perticular 1 Edittext, even on EditText Touch or Click.

More Related questions