user1526338
user1526338

Reputation: 33

SoftKeyboard not Appearing automatically in Landscape Mode

I have EditText with with <requestFocus /> in the XML . when I open the Activity in Portrait Mode the soft keyboard Appearing automatically,But when I start the activity in Landscape Mode the soft-keyboard not appeared automatically .I required touching the EditText for soft-keyboard .

Want a soft keyboard to appeared automatically in landscape mode .

Android Manifest

<activity
            android:name="activity"
            android:windowSoftInputMode="adjustResize"
           >

whats a problem kindly help me

Upvotes: 2

Views: 539

Answers (4)

K Guru
K Guru

Reputation: 1302

Please check this ,I have test this solution and it is working perfect

@Override
    protected void onResume() {
        super.onResume();
        mUserNameEdit.requestFocus();

        mUserNameEdit.postDelayed(new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                InputMethodManager keyboard = (InputMethodManager)
                getSystemService(Context.INPUT_METHOD_SERVICE);
                keyboard.showSoftInput(mUserNameEdit, 0);
            }
        },200);
    }

Upvotes: 3

Adrian Cid Almaguer
Adrian Cid Almaguer

Reputation: 7791

Edit: Try with this code

editText1 = (EditText) findViewById(R.id.editText1);

InputMethodManager input = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
input.showSoftInput(editText1, RESULT_UNCHANGED_SHOWN);

Upvotes: 0

Anil Meenugu
Anil Meenugu

Reputation: 1431

setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE | LayoutParams.SOFT_INPUT_ADJUST_PAN )

Upvotes: 0

Hanish Sharma
Hanish Sharma

Reputation: 869

InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE);

for show keyboard use this in the below if conditions,I hope it will work

imm.showSoftInput(ed, 0);

You can do this by:

For Lanscape

if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
    //Do some stuff
}

For Portrait

if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
    //Do some stuff
}

Upvotes: 0

Related Questions