I am relatively new to Android development. My requirement is such that I have a multiple line input box(such as comment box); as the user clicks the box a soft-key keyboard appears on screen which has either an "Enter" button or "Next" Button as an Action key.
I want the keyboard to have both, "Enter" as well as "Next" Button and also the comma(,) button.
I have searched throughout the web. They only have options to specify the "android:imeOptions" tag. But this option does not give the desired output as I need.
Kindly help.
PS: I do not want to create a custom keyboard. Just want to modify the existing soft-key keyboard to be displayed.
Also, I am working on Android v2.2
Thanks for your help.
I want the keyboard to have both, "Enter" as well as "Next" Button and also the comma(,) button.
There is, at most, one action key for an input method editor (a.k.a., soft keyboard). You cannot have two. Depending on the input method editor, you may have zero, as the input method editor is not obligated to show an action key.
Related
I need my soft keyboard input to have both return button AND done button so that the user can write paragraphs in my EditText and click on Done to close the keyboard. Is this possible?
I've tried:
android:inputType="textMultiLine"
android:imeOptions="actionDone"
together but it didn't work.
PS: I'm testing on Samsung keyboard type.
No, I believe it's not possible prior to API level 11 (3.0).
The same issue cropped up here (discussed in the comments to the accepted answer):
Android Soft keyboard action button
From the final comment:
Looking at a few apps on my phone, it seems common to have the multiline box last, with a visible "Done" or "Send" button below it (e.g. Email app).
I have a EditView. When some one clicks on the EditView, the only way the keywbaord will go away is if the back button id press.
I saw some apps have it so when the keyboard comes up, there is a button that says done in the lower right hand corner. When this is press the keyboard goes away.
My app does not do this, does anybody know how they did this?
Also is it possible to have the keyboard go away when the enter key is press, insrad of having it add another line of text?
You can either use TextView.setImeOptions() and pass it actionDone or use the android:imeOptions="actionDone" attribute in your layout.
To close when enter is pressed, use a custom OnEditorActionListener. However, it would probably be better to change the enter key to done as above so as to convey what action will occur.
See this SO question.
Is there a way to find out when did a user click "Setting" options on the screen menu?
The onClick listner's KeyDown events catches only the hardware buttons on the phone and not the clicks of the sofware keyboard that shows up when a textbox/editText gets a focus and the key guard shows up.
Is it even possible using public android SDK.
P.S. : I am only concerned with 2.2 and 2.3 so its fine if this is not possible on 3.0 and above.
Thnx
EDIT
Explanation of a scenario that will help understand the question better!
I have a full screen activity with a editText and a button. I want to intercept all the clicks that a user make and based on that make some decisions.
I am able to register a listner to intercept what phisical keys are being clicked(HOME, MENU, VOLUME UP/DOWN etc)...The problem is, when the user clicks on the editText i.e. the text box gets the focus, the sotware keypad shows up. Now I also want to intercept what keys(numbers, alphabets, special characters or even custom functions on some samsung android phone like 'Go To Settings' are clicked and perform action based on the clicks.
My question is, is it possible and if yes, then how?
NOTE: Please dont ask me why am I doing this because its bad user experience. I am very much aware of that. I am trying to do this in a particular context that needs this functionality. Thnx!
You need to use the KeyListener class and setKeyListener
http://developer.android.com/reference/android/widget/TextView.html
This only allows you to modify/filter input into the TextView.
I have a webform that is integrated into a native app via a webview. But now when the user sets the focus on the first textbox of the form, I see a Go button on the soft keyboard. Instead, I'd like to have Next button, clicking on which would take me to the next input control. And the last input control alone should have Go button on keyboard. How do I achieve this? (Note: Please note that I want this on a web form. I've already found material on how to do this on a native form.)
Please go to take a look, is that what you are looking for?
How to change the Android softkey keyboard "Go" button to "Next"
I'm attempting to replicate on android an iphone app my company had developed externally.
My need is simple but it seems hard to achieve under android. I have three numeric edittext inputs. Each should take only decimal numeric values. So numbers 0-9 and "." or ",". On the iphone this was achieved by a slide in calculator style keypad with one of the buttons a "GO" button that when pressed hides the keypad and, if all the inputs have valid values triggers a calculation that displays values on the screen.
I've tried the android phone input type and this is very close to what I want but I have no idea how to replicate the go button. I have put a calculate button on the main interface itself but I can't get the keyboard to go again once it is opened.
So can I either
A. Modify the layout of the phone keypad in some way to change one of the buttons to be
GO (Calculate) and intercept the keypress or
B. Do I have to create my own keypad in which case how do I go about sliding it in and out
over the top of the current view?
thanks guys
See android:imeActionId and android:imeActionLabel for your GO button.