UMAR-MOBITSOLUTIONS
UMAR-MOBITSOLUTIONS

Reputation: 77984

how to disappear keyboard onCreate Method?

friends,

i have a EditText on simple activity with a button. when every i move from one activity to this acivity focus is automatically set to EditText and keyboard appears in phone.

i dont want to open keyboard untill i click on editText.

can any one guide me what should i do?

any help would be appriciated.

Upvotes: 0

Views: 1134

Answers (3)

user1414160
user1414160

Reputation:

You can also pass the same thing in AndroidMenifest file for that particular activity like:

        <activity
            android:name="Activity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" >
        </activity>

This will also work for you :)

Upvotes: 0

Vishal Khakhkhar
Vishal Khakhkhar

Reputation: 2116

EditText.setInputType(InputType.TYPE_NULL); 

Upvotes: 1

Donal Rafferty
Donal Rafferty

Reputation: 19826

You can use the following line of code to make sure the keyboard doesn't pop up when the activity starts and only pops up when a user clicks into an EditText

Place it in the onCreate method of your activity

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

Upvotes: 3

Related Questions