I have EditText widget on my activity.
How should I make/handle "commit" in that text field?
I saw that some applications control keyboard and there is "Done" or "Ok" key instead of "Enter". Maybe this is how should I do it... But I don't know how how to do it.
Related
What im wondering is, should i hide "continue" button while EditText is empty? Is there a principle not recommending that? Alternative solution is popping up error dialog warning user to enter text. Thanks.
It would be better to use Text Validator, so that user will click continue, then popup will appear near the text and show what is going wrong with certain field.
It may be similar to something like this:
EditTextValidator
I have an application where user needs to input some text. When I click the editText area a keyboard appears and then I input the text after which I have to press the "back" key on my phone to hide the keyboard and then press the submit button which is getting annoying.
How do I get that "ok" button that does it for me which I am used to? I have Android version 2.3.6 on my phone. Is this even available at this API level ?
Use onEditorActionListener http://developer.android.com/reference/android/widget/TextView.OnEditorActionListener.html on your EditText.
Also see: EditorInfo http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Close/hide the Android Soft Keyboard
I'm a beginner, and have written a simple program to find the roots of a quadratic equation. Entering values in the EditText fields works well, because the virtual keypad pops up so that you can enter your numbers. However, the keypad covers the TextView where your results appear. If the user knows it, they can press the "back" key, and the keypad is removed, revealing the results field. But I want the keypad to disappear when the user touches the "execute" button in the app without pressing the "back" key.
I have been researching this, and some suggested using finish(); But this doesn't only remove the keypad, it also exits the whole program.
So what's the easiest way to only remove the keypad, leaving the underlying TextView displayed? I want to include this in the onClick view that executes the math.
Any suggestions are appreciated.
Just add this code in the onClick method:
InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(yourSubmiBtn.getWindowToken(), 0);
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.
In my app,I have an edittext and a PopupWindow.
I want to show the popup once the user starts editing the text. but when I show the popup, it graps the focus from the edittext, and the virtual keyboard is dismissed (and I want it shown).
I tried creating the popup as not focusable, but then I can't select it after it's shown.
I also tried changing the focus and selection attributes of both edittext and from code after and before the popup is shown, but if the popup is created as not focusable, I can't select it after it's shown.
Is there a way of displaying a selectable popup along with editing the edittext?
You could try going in other direction. you have to control the input method editor (IME). every editable has an appropriate IME (also edittext has). You can control the IME - for example to be shown all the time not regarding to the state of edittext and dismiss it when you click on something or something happen.
You can ovveride the default editext implementation or you can control the IME at the viewgroup container/activity level.
http://developer.android.com/resources/articles/on-screen-inputs.html (read the APIs for controlling IMEs at the end).
hope this will help.