Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When click on editText show the android keyboard

 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could you please tell me how can i show the keyboard only when i click in editText and not when the activity started.
I did a test as follows :

But always, when the activity started the keyboard automatically display :/ or i want it display only when i click on edittext.
Thank you in advance
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The keyboard shows because you explicitly ask it to show using these methods:

If you don't want it to show, then don't call those methods. It should show when the user clicks on the EditText by default (when the field gets focus, the keyboard shows). So try using the app without specifically calling those methods and see if it happens. If the soft keyboard doesn't show for some reason then you should figure out why. The most likely reason is because the OS thinks there is a hard keyboard available (if you are an emulator and the emulator has a keyboard then that counts as a hardware keyboard and would prevent the soft keyboard from showing).

There are cases where you will need to force the keyboard to be shown, so if you do, then you would use an OnFocusChangeListener to see when the EditText gets focus, and show the keyboard then. But be careful... don't force the soft keyboard to show when there is a hard keyboard available! Folks who buy phones with hardware keyboards will get upset.
 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remove those statement, and also the same problem.
Could you please tell me how can i use "OnFocusChangeListener"?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show the code you have now and describe the behavior you see and what you want in better detail. It isn't clear now what the issue is.
 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply,
I just add this statement in my AndroidManifest.xml :

And it's work
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic