In my app i would like to forbid the use of virtual keyboards since want to avoid the user being able to insert emojis via the keyboard. I managed to remove the emoji button from the default keyboard by setting the EditText inputType properties to android:inputType="textVisiblePassword|text", based on this answer/ question.
But given the case that the user uses a different virtual keyboard, the emoji button is back again of course.
Question: Is there a way to forbid virtual keyboards inside the app? So that only the default keyboard can be used.
And if not: How can i make the EditText field not accept any emojis from the user keyboard?
Thanks for your help!
Related
I need to provide an option for the user to switch to AlphaNumeric Keyboard from the Numeric keyboard below, i was thinking can i make use of the empty keys in the numeric Keyboard and customize it with say abc so it can switch to alphanumeric keyboard.
Unless you want to make your own implementation of a keyboard, the only way to control it's appearance is via the InputType of your EditText.
You simply can't modify any buttons of the system keyboard. It will look different depending on the manufacturer anyways.
Here's what you could do:
Change the InputType (for the EditText that needs alphanumeric input or via a toggle button or...)
Implement your own keyboard for your specific needs
I have an edittext in my application that gets only numeric keys. It worked fine with a filter for the keys that the user enters and with numeric keyboard shows up when the user touches the edittext box.
when I installed the app on android 7 device, the numeric keyboard shows up and after few seconds, it is hidden and an alphanumeric keyboard replaced it.
I need only numeric one!!
I assume that I need to "listen" to keyboard event and when I got any change in the keyboard type, I should act to change it back.
Anyone to tell me how to do it??!!
In your xml file give below property to your edit text
android:inputType="number"
Is there an event that is fired when user changes input language on his/her virtual keyboard?
I'm trying to change Edittextfield layoutDirection on the go, if user decides to change the keyboard language (from English to Hebrew for example).
Thanks!
There is no other way.
You have to made a custom keyboard to send custom event (Input Type) to your application.
If I have set android keyboard as default in keyboard setting and I clicked in EditText in my application then I am getting keyboard in english. But in my application there is an edittext to enter username. I need to show japanese soft keyboard. How to achieve this? I can long click on the edit text and set the input type as Japanese IME. can I do this programmetically without setting keyboard type explicitly? How to set default keyboard type for any particular EditText.
Users choose their input method editors, not applications. Allowing an app to change the keyboard would be a security flaw.
Try looking at InputType
I'd like to highlight the text in an EditText when a keyboard opens for user input (this could be a hardware keyboard or the virtual keyboard).
Highlighting isn't my problem, my problem is a trigger to highlight. Is there a handler that gets executed when the keyboard appears on a specific View (in this case, my EditText)? Are there different handlers for hardware keyboard vs virtual keyboard?
As far as I know, you can't get notified of those things at that level. Why not just highlight it when the EditText gets focus? In practice this will generally mean that an IME is displayed.
In fact, there is already a method to do exactly this: setSelectAllOnFocus.