n~droid generation

Taking ndroid for a ride…

Show soft keyboard with EditText on android

Show soft keyboard with EditText on android

So you wish to show or hide the virtual (soft) keyboard in your Android app.

While you are executing n action that places focus into the EditText field you wish for the keyboard to pop up.
You need to tell android (or the emulator) to bring up a the soft keyboard.
Note:
EditTexts are focusable while the system is in ‘touch mode’.
The first click event focuses the control, while the second click event actually fires the OnClickListener.
If you disable touch-mode focus with:
(xml) View attribute
OR
(java)
Then OnClickListener should fire as expected.


To launch the keyboard requires the following additional code:
xml:
——

 

Notice the imeOptions: actionSend|flagNoEnterAction:

The tell you android to apply the SEND button action to the EditText and not to accept ENTER on soft keyboard.
Java:
——-
FIRST POSSIBILTY USING THE setOnClickListener:

SECOND POSSIBILTY USING THE setOnFocusChangeListener:

You do not need to use both…
they can be implemented for other use.

Jud Luck…

Leave a Reply

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


+ four = 12

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Development & Design: http://nwg.co.il
  • Google+
  • LinkedIn