Hide Android keyboard [duplicate]










0
















This question already has an answer here:



  • Stop EditText from gaining focus at Activity startup

    48 answers



I have been trying to hide the keyboard when user enters an activity,i checked and tried various ways and method but the one I lost see is hide keyboard on button click. I don't want the keyboard to hide on only button, I want it to be hidden when the activity starts. I also tried to put the code in an onCreate method but still the same.another on I saw on Android arsenal was to click on any part of the screen to hide the keyboard was nice but still I still prefer the keyboard hidden when the activity starts, please is there any way hiding the keyboard when the activity starts?










share|improve this question













marked as duplicate by TheWanderer, Community Nov 19 '18 at 18:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • So you have EditTexts in the Activity I'm guessing?

    – TheWanderer
    Nov 15 '18 at 2:13











  • In your manifest add ths line inside the <activity> tag add this: android:windowSoftInputMode="stateHidden"

    – Sayok Majumder
    Nov 15 '18 at 9:31
















0
















This question already has an answer here:



  • Stop EditText from gaining focus at Activity startup

    48 answers



I have been trying to hide the keyboard when user enters an activity,i checked and tried various ways and method but the one I lost see is hide keyboard on button click. I don't want the keyboard to hide on only button, I want it to be hidden when the activity starts. I also tried to put the code in an onCreate method but still the same.another on I saw on Android arsenal was to click on any part of the screen to hide the keyboard was nice but still I still prefer the keyboard hidden when the activity starts, please is there any way hiding the keyboard when the activity starts?










share|improve this question













marked as duplicate by TheWanderer, Community Nov 19 '18 at 18:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • So you have EditTexts in the Activity I'm guessing?

    – TheWanderer
    Nov 15 '18 at 2:13











  • In your manifest add ths line inside the <activity> tag add this: android:windowSoftInputMode="stateHidden"

    – Sayok Majumder
    Nov 15 '18 at 9:31














0












0








0









This question already has an answer here:



  • Stop EditText from gaining focus at Activity startup

    48 answers



I have been trying to hide the keyboard when user enters an activity,i checked and tried various ways and method but the one I lost see is hide keyboard on button click. I don't want the keyboard to hide on only button, I want it to be hidden when the activity starts. I also tried to put the code in an onCreate method but still the same.another on I saw on Android arsenal was to click on any part of the screen to hide the keyboard was nice but still I still prefer the keyboard hidden when the activity starts, please is there any way hiding the keyboard when the activity starts?










share|improve this question















This question already has an answer here:



  • Stop EditText from gaining focus at Activity startup

    48 answers



I have been trying to hide the keyboard when user enters an activity,i checked and tried various ways and method but the one I lost see is hide keyboard on button click. I don't want the keyboard to hide on only button, I want it to be hidden when the activity starts. I also tried to put the code in an onCreate method but still the same.another on I saw on Android arsenal was to click on any part of the screen to hide the keyboard was nice but still I still prefer the keyboard hidden when the activity starts, please is there any way hiding the keyboard when the activity starts?





This question already has an answer here:



  • Stop EditText from gaining focus at Activity startup

    48 answers







android android-studio android-layout keyboard






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 1:57









Ayodele KayodeAyodele Kayode

11928




11928




marked as duplicate by TheWanderer, Community Nov 19 '18 at 18:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by TheWanderer, Community Nov 19 '18 at 18:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • So you have EditTexts in the Activity I'm guessing?

    – TheWanderer
    Nov 15 '18 at 2:13











  • In your manifest add ths line inside the <activity> tag add this: android:windowSoftInputMode="stateHidden"

    – Sayok Majumder
    Nov 15 '18 at 9:31


















  • So you have EditTexts in the Activity I'm guessing?

    – TheWanderer
    Nov 15 '18 at 2:13











  • In your manifest add ths line inside the <activity> tag add this: android:windowSoftInputMode="stateHidden"

    – Sayok Majumder
    Nov 15 '18 at 9:31

















So you have EditTexts in the Activity I'm guessing?

– TheWanderer
Nov 15 '18 at 2:13





So you have EditTexts in the Activity I'm guessing?

– TheWanderer
Nov 15 '18 at 2:13













In your manifest add ths line inside the <activity> tag add this: android:windowSoftInputMode="stateHidden"

– Sayok Majumder
Nov 15 '18 at 9:31






In your manifest add ths line inside the <activity> tag add this: android:windowSoftInputMode="stateHidden"

– Sayok Majumder
Nov 15 '18 at 9:31













2 Answers
2






active

oldest

votes


















1















Your solution is here




There's yet another point of contention to be aware of. By default, Android will automatically assign initial focus to the first EditText or focusable control in your Activity. It naturally follows that the InputMethod (typically the soft keyboard) will respond to the focus event by showing itself. The windowSoftInputMode attribute in AndroidManifest.xml, when set to stateAlwaysHidden, instructs the keyboard to ignore this automatically-assigned initial focus.



<activity
android:name=".MyActivity"
android:windowSoftInputMode="stateAlwaysHidden"/>


Almost unbelievably, it appears to do nothing to prevent the keyboard from opening when you touch the control (unless focusable="false" and/or focusableInTouchMode="false" are assigned to the control). Apparently, the windowSoftInputMode setting applies only to automatic focus events, not to focus events triggered from touch events.



Therefore, stateAlwaysHidden is VERY poorly named indeed. It should perhaps be called ignoreInitialFocus instead.






share|improve this answer


















  • 1





    Worked for me! thanks.

    – Umesh Patadiya
    Dec 26 '18 at 9:04


















0














Write this line on oncreate method



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






share|improve this answer





























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    Your solution is here




    There's yet another point of contention to be aware of. By default, Android will automatically assign initial focus to the first EditText or focusable control in your Activity. It naturally follows that the InputMethod (typically the soft keyboard) will respond to the focus event by showing itself. The windowSoftInputMode attribute in AndroidManifest.xml, when set to stateAlwaysHidden, instructs the keyboard to ignore this automatically-assigned initial focus.



    <activity
    android:name=".MyActivity"
    android:windowSoftInputMode="stateAlwaysHidden"/>


    Almost unbelievably, it appears to do nothing to prevent the keyboard from opening when you touch the control (unless focusable="false" and/or focusableInTouchMode="false" are assigned to the control). Apparently, the windowSoftInputMode setting applies only to automatic focus events, not to focus events triggered from touch events.



    Therefore, stateAlwaysHidden is VERY poorly named indeed. It should perhaps be called ignoreInitialFocus instead.






    share|improve this answer


















    • 1





      Worked for me! thanks.

      – Umesh Patadiya
      Dec 26 '18 at 9:04















    1















    Your solution is here




    There's yet another point of contention to be aware of. By default, Android will automatically assign initial focus to the first EditText or focusable control in your Activity. It naturally follows that the InputMethod (typically the soft keyboard) will respond to the focus event by showing itself. The windowSoftInputMode attribute in AndroidManifest.xml, when set to stateAlwaysHidden, instructs the keyboard to ignore this automatically-assigned initial focus.



    <activity
    android:name=".MyActivity"
    android:windowSoftInputMode="stateAlwaysHidden"/>


    Almost unbelievably, it appears to do nothing to prevent the keyboard from opening when you touch the control (unless focusable="false" and/or focusableInTouchMode="false" are assigned to the control). Apparently, the windowSoftInputMode setting applies only to automatic focus events, not to focus events triggered from touch events.



    Therefore, stateAlwaysHidden is VERY poorly named indeed. It should perhaps be called ignoreInitialFocus instead.






    share|improve this answer


















    • 1





      Worked for me! thanks.

      – Umesh Patadiya
      Dec 26 '18 at 9:04













    1












    1








    1








    Your solution is here




    There's yet another point of contention to be aware of. By default, Android will automatically assign initial focus to the first EditText or focusable control in your Activity. It naturally follows that the InputMethod (typically the soft keyboard) will respond to the focus event by showing itself. The windowSoftInputMode attribute in AndroidManifest.xml, when set to stateAlwaysHidden, instructs the keyboard to ignore this automatically-assigned initial focus.



    <activity
    android:name=".MyActivity"
    android:windowSoftInputMode="stateAlwaysHidden"/>


    Almost unbelievably, it appears to do nothing to prevent the keyboard from opening when you touch the control (unless focusable="false" and/or focusableInTouchMode="false" are assigned to the control). Apparently, the windowSoftInputMode setting applies only to automatic focus events, not to focus events triggered from touch events.



    Therefore, stateAlwaysHidden is VERY poorly named indeed. It should perhaps be called ignoreInitialFocus instead.






    share|improve this answer














    Your solution is here




    There's yet another point of contention to be aware of. By default, Android will automatically assign initial focus to the first EditText or focusable control in your Activity. It naturally follows that the InputMethod (typically the soft keyboard) will respond to the focus event by showing itself. The windowSoftInputMode attribute in AndroidManifest.xml, when set to stateAlwaysHidden, instructs the keyboard to ignore this automatically-assigned initial focus.



    <activity
    android:name=".MyActivity"
    android:windowSoftInputMode="stateAlwaysHidden"/>


    Almost unbelievably, it appears to do nothing to prevent the keyboard from opening when you touch the control (unless focusable="false" and/or focusableInTouchMode="false" are assigned to the control). Apparently, the windowSoftInputMode setting applies only to automatic focus events, not to focus events triggered from touch events.



    Therefore, stateAlwaysHidden is VERY poorly named indeed. It should perhaps be called ignoreInitialFocus instead.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 15 '18 at 3:06









    D PrinceD Prince

    575621




    575621







    • 1





      Worked for me! thanks.

      – Umesh Patadiya
      Dec 26 '18 at 9:04












    • 1





      Worked for me! thanks.

      – Umesh Patadiya
      Dec 26 '18 at 9:04







    1




    1





    Worked for me! thanks.

    – Umesh Patadiya
    Dec 26 '18 at 9:04





    Worked for me! thanks.

    – Umesh Patadiya
    Dec 26 '18 at 9:04













    0














    Write this line on oncreate method



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






    share|improve this answer



























      0














      Write this line on oncreate method



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






      share|improve this answer

























        0












        0








        0







        Write this line on oncreate method



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






        share|improve this answer













        Write this line on oncreate method



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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 11:08









        Shiva KanumalaShiva Kanumala

        7114




        7114













            Popular posts from this blog

            How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

            Syphilis

            Darth Vader #20