Android Show keyboard automatically

consider you want to show keyboard when new activity started and your edittext also have focus for this you can use following code

EditText txtRecieverName=(EditText)findViewById(R.id.txtRecieverName);
       if(txtRecieverName!=null){
          
           txtRecieverName.requestFocus();
           getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
       }

 

Leave a Reply

Your email address will not be published. Required fields are marked *