Go from One Input field to another in android - android

I have multiple text fields in my Android activity. When the user enters data in one text field and press enter, I want the cursor to move to another text field which is next to the current text field.

You can use android:nextFocusForward to specify which view will receive focus after the action button is pressed, this is the default action button.

Related

How to set dynamic text to edit text from the custom keyboard

I want to set dynamic text to my edit text from the custom keyboard.
For example if I press "a" from the my keyboard then I want to set clipboard data to my edit text.
I use following demo for custom keyboard,
https://github.com/blackcj/AndroidCustomKeyboard
And it work perfect, but I want to just customize it, I want to override my functionality on it, if I am press any of alphabet then I want to perform my action on application edit text.
Please suggest how to do this , and this is possible to paste my clip board data to edittext from the my custom keyboard any key event?
You should have call back method for each key pressed by user, so you can set your custom test to edit text.
You must have class that extends InputMethodService which overrides onKeyDown method where you can write code to set custom text to edit text based on key pressed by user.

Replace Go button on soft keyboard with Next in Phonegap

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.

How to put a button on the default keyboard? I want a button that when is pressed, it chance to another activity

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.

Android Development: Keep EditText Selection Highlight On Lose Focus?

I was wondering if it's possible to keep an EditText's orange highlight around selected text when the EditText loses focus, until the user changes the selection?
I'm creating a find/replace feature in my app and say if the user selects the first 3 characters in the EditText, then decides that he/she wants to replace the selection with XXXXX and clicks on the other EditText that the user inputs what they want to replace with, the orange highlight dissappears from the original EditText, so the user can forget what he/she is going to replace, therefore I'm wondering how I can keep the orange highlight even on lose focus to prevent the confusion.
Thanks.

How to map Soft Keyboard button to button on screen in Android?

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.

Categories

Resources