How to open Android keyboard show only custom digits in Android - android

I want to show digits "0123456789/" on keyboard if open on click of SearchViewbut I don't know how it can be done. I am able to set InputType to a searchview like this
searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
but not able to set custom digit to show on a keyboard.
from input type InputType.TYPE_CLASS_NUMBER numeric keyboard is opening but i also want to show "/" also with numeric digits 0123456789.
I searched a lot on SO but didn't find any solution for this.

There is no easy solution for this. You have two options depending on what you can work with and what exactly you want.
If it is exactly as you say in your question, that is, to SHOW
just the Characters that you specify, then the way to go about doing
that would be to create a Custom SoftKeyboard. This will allow you
to take only the desired inputs and will show only those characters
that you have specified.
Otherwise you can disable taking other
characters input (that are not to be available), by working with
[onQueryTextChanged]1 where you manipulate to resend only the
values that you can take in as input. Here the default
softKeyboard is used, but the input taken in by the SearchView are
as per specification.
Note : my knowledge is mainly based on working with EditText rather than SearchView, so not able to provide exact codes for the above

Related

Android: Pull out emoji keyboard on button press

I know that you can specify a short message input type in order to turn the enter key of the keyboard into an emoji button and pressing it will show up the emoji list but what i want to do is open up the emoji list programatically from a button. Is this possible?
There is no functionality to add tabs to any generic keyboard. Certain keyboards may support it, but it isn't a common feature. You could write your own fully custom keyboard, but that's a lot of work and will piss off many users.
Also, I'm not sure what you mean about by like in hangouts. I use hangouts- it doesn't do anything odd with my keyboard. It stays as Swype, there's no special emoji tab. It may be a feature of your favorite keyboard based on the input type (I assume both use input type textShortMessage). But it isn't a generic feature.
See Link Android Keyboard with Emoji
Thanks and enjoy...

Android - Set EditText keyboard input type to symbols and numbers ("?123")

I have an editText and I want to make the number and symbols pad (the "?123") as the default input type since the user will mostly input numbers, slashes, and the percent sign.
I've look around the questions here, but those mostly show the number pad instead. I've tried the solution to this problem editText.setRawInputType(Configuration.KEYBOARD_QWERTY); but it shows the number pad on android 4.4.4.
Now I'm stuck because the input types in the xml do not seem to show the ?123 pad. I was thinking of doing it programatically instead but that seems to be a dead end as well.
Any ideas anyone?
There is no way to do that. All you can do is give it the input type. The keyboard itself will decide what to display based on the EditorInfo (which holds the input type and a few other pieces of information) and it will differ for each keyboard- remember that not all phones will use the default keyboard, and some OEMs (Samsung) have their own they replace the default with). Your only real option is to send a numeric inputType, and hope it displays what you want.
Try InputType instead of Configuration. Check this out.

How to make an edit text start out numeric but accept text also

In my application I have an EditText (Actually it's an implementation of MultiAutoCompleteTextView, but I don't think that matters) in which the user can enter a formula to be calculated, although generally they will want to just enter an integer.
What I would really like is for the keyboard to open with the numeric keyboard showing, but allow them to change to text if they want.
As standard of course it shows the letters and allwos them to change to numbers, which is OK, but 90% of the time they will want the numbers.
I tried doing:
operandEditText.setInputType(InputType.TYPE_CLASS_NUMBER|
InputType.TYPE_NUMBER_FLAG_SIGNED|InputType.TYPE_CLASS_TEXT);
But the result was a numeric keypad with letters written on the number keys (like a phone keypad), and it didn't write letters anyway.
I'm also aware that I could add a button, spinner or something that changed the input mode of the widget, but the aim of this is to make the interface easier to use, and I'm not sure adding another control will achieve that.
Is there a way to make it do what I want?

How can you configure an EditText's soft keyboard to use numbers initially, but still allow text?

I want to let users input a postal code to my app. The common use case is the US zip code, which are composed solely of numbers, so I'd like to display the numeric keyboard initially in the soft input. However, not all postal codes are solely digits, so I still need users to be able to enter other characters.
I've been trying to do this with android:inputType, but by setting the "number" flag, it automatically blocks any input except for number-based stuff. Is there a way to just accept general text, but get the soft keyboard to initially display a more number-based keyboard?
Have you tried initially setting the inputType to "number" and then via a TextWatcher changing the input type of the TextView programatically?

How do i add words to the suggestions on top of the soft keyboard

Is there any way to add words to the suggestions in the soft keyboard?
For a specific Edittext field i would like to add a list of names to the suggestions that pops up on top of the soft keyboard in android 2.0.
Does anyone know if this is possible?
Here is the source code of the soft keyboard.
If you go through the code, you will see that it uses a Suggest class which inside has different dictionaries.
If you want to add words for a specific EditText you would need to add and remove or change freq of a certain word from those dictionaries.
Some issues:
I couldn't find a way to get the InputMethodService's instance. (If you can, please answer my question here)
Android allows developers to program their own InputMethodService. I am working on one myself and my implementation doesn't use that dictionaries. So your feature will not work with my IME.
I would suggest using Auto Complete.
You can't add additional words to the ones the IME finds internally, however you can whole-sale supply your own completions via InputMethodManager.displayCompletions():
http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#displayCompletions(android.view.View, android.view.inputmethod.CompletionInfo[])
This is what the auto complete text view uses to show its completions in the IME, when the IME is full screen so it can't be seen. Note that your app is still responsible for showing the completions itself, so they will be available to the user if the IME is not full screen.
(And sorry about the lack of documentation on that method.)

Categories

Resources