Is there any way out for mapping the Done button to the button on the screen in Android. What I want is that I have one login screen user enters username and presses the next button on the soft keyboard which brings the focus on password field. AFter entering password when the user presses done button then the action which is performed on login button should be called.
Let me know if this is possible.
In your layout file, you can specify the focus order using attributes like nextFocusDown. If you have the focus order configured properly, hitting next should automatically take you to the next focusable element.
You can also add a KeyListener to the edit text to listen for the next key and set the focus accordingly.
Related
Phonegap input type text show Go button on soft keyboard, I have multiple text boxes so want Next button on keyboard so user can move easily and on last input want Go so user can press to submit form.
And on Android kitkatt keyboard top bar also not displaying Next|Prev buttons.
Having a "Next" button instead of "Go" for input type="text" would not be possible with Android as of now.
Android will always display "Go" button for form input fields irrespective of the position of the field you are at in the form. "Go" is basically reflecting the same behavior as of an "Enter" button on a normal browser & keyboard.
There are two possible hacks to come closer to what you need (still won't change "Go" to "Next" but will help "Go" act as "Next") -
Hack 1 - Hijack Enter key event & move focus to next fields
Like I mentioned the "Go" key replicates the "Enter" key, you can capture the enter key event using JavaScript & make it move focus to next fields in form until its your last field. Once last field reaches you can allow it to act as enter. So basically Go will keep moving focus to next fields until its your last field & then will submit the form.
I have answered a solution to a similar requirement here - How to trigger a Tab when user presses Enter, you can try implementing the same in your app.
DEMO LINK - http://codepen.io/nitishdhar/pen/Gxbhm
Hack 2 - Force form validation & move focus to next invalid fields
If you want to prevent users from submitting the form, you can put required validations on the form using java-script & if some field is not filled, upon pressing "Go" the focus of the cursor can be brought to the next "not filled" field. So in a way giving the impression of - "Pressing Go & moving to next field to be filled"
Try this plugin - http://jqueryvalidation.org/ this behaves in the way explained i.e moves focus to the next required or invalid field.
Also I think some android versions show some tab key on the keyboard to move between fields, buts its not Next.
All the best.
I have a EditText in my activity. I want that when the user finish the text, he can move to the next activity without press back button to hide the keyboard. I was wondering if there a way to put a button on softkeyboard to move to next activity.
(Sorry for bad english, its not my native language)
You can't add buttons to an existing keyboard. However, you can suggest a label and id for the custom IME action. See TextView.setImeActionLabel:
Change the custom IME action associated with the text view, which will be reported to an IME with actionLabel and actionId when it has focus.
You'll then have to call TextView.setOnEditorActionListener to provide a custom listener to listen for that IME event where you can then move to your next activity.
is there any way to define how far a view is moved up when the soft keyboard appears? In my case i have a Username and a Password EditText close to the bottom of my view, when the user now clicks on the Username field the soft keyboard appears and the View is automatically moved up so that you can see the Username EditText. But then the user is not able to see the Password EditText, which is kindof counter-intuitive. When the user once klicked on the Password Field and then goes back to the Username Field everything looks like i want it to look.
Im am using Android 2.3.3 API Level 10
I did add
android:windowSoftInputMode="adjustPan"
in my activity since i don't want the view to resize when the keyboard appears.
without keyboard:
with keyboard and Username focus:
after click on password - also desired behaviour after click on Username:
I have a WebView which has a form containing 10 editboxes. When I type in an editbox I find that in the softkey keyboard Go button is visible which eventually takes me to the next page. But I want Next button which should take me to the next editbox, not to the next page. So, how to change the softkey keyboard "Go" button to "Next" in Android?
In the xml, specifiy for your editboxes the attribute android:imeOptions="actionNext" .
The next button will bring the user into the next field that accept input.
Take a look at http://developer.android.com/resources/samples/SoftKeyboard/index.html which may help you.
I would like to know when the user presses the 'enter/done/next' key on the soft keyboard without the activity knowing which edittext box the user is in. I have seen some code, but it always uses the name of the edittext box that is being edited.
The app has numerous edittext boxes, and calculations are re-run anytime any one of the values in a edittext box is changed.
Then attach the OnEditorActionListener to all of them.