How to disable EditText auto complete when using textEmailAddress - android

I have an edit text with inputType set to textEmailAddress and I can't stop the keyboard from showing text suggestions. I want to use this flag so that the # sign shows up in the first set of keyboard characters but I don't want suggestions to appear because they consume a lot of space on the screen and mess up the user experience.
This is the code I'm using:
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/common_email"
android:imeOptions="actionDone"
android:inputType="textEmailAddress"
/>
I have tried changing inputType to
android:inputType="textNoSuggestions|textEmailAddress"
and to
android:inputType="textVisiblePassword|textEmailAddress"
but it doesn't work. It seems that when used, textEmailAddress overrides whatever the other flags do.
Is there a way to show to make the keyboard show the # sign but not show suggestions?

There is no way to absolutely assure that a keyboard doesn't show suggestions. Keyboards have total control over what they display, including suggestions. Anything you send it is just a hint as to what it should do, different keyboards interpret or ignore those hints as they please.
textVisiblePassword|textEmailAddress won't work- those are both specifying a major type. The result will be an ORing of their bits and you'll get something really weird. textNoSuggestions is the best bet. If that isn't working, then that keyboard either never honors no suggestions or doesn't for email fields.
As for showing the # sign- same deal. Keyboards control what keys they show. They may change slightly for different modes, but there's no way to force specific keys to show.
As a side note- I'm not certain turning off suggestions for email is the right thing to do. Many keyboards will add all email addresses in contacts into their dictionaries. Many users will add their own email to the dictionary for filling in forms. And many email addresses are combos of common words. Depending on how good the keyboard is with email mode, being able to do autocorrect is a better experience.

Try this, it worked for me.
android:importantForAutofill="no"

Related

android inputType="number" and "numberPassword" different keyboards, how to make same keyboards?

When in EditText xml layout I set android:inputType="number" I see one keyboard, with dash, dot and comma.
When I set android:inputType="numberPassword" I see another keyboard, only numbers this time.
How do I show keyboard with only numbers, without dot and comma, for a non-password EditText?
if you need only numbers then best option for you would be android:inputType="numberSigned"
and the keyboard... well, in fact keyboard style doesn't depend on you... this is another separated app installed in system and it try to fit inputType of EditText. some keyboard apps may have different buttons for inputType="number" and inputType="numberPassword", some other may have same UI, yet some other may just have one UI with all buttons for all inputTypes (thus some of these buttons may be inactive, e.g. letters when digit-only inputType)
even when your keyboard app provides different keyboard style doesn't mean that on another device with another keyboard app this behavior will be the same
you can join 2 types in inputType EditText in android
this link all type for EditText
for example you can use :
android:inputType="numberSigned|numberDecimal"
or
android:inputType="numberDecimal"

Is there a way to show numeric keypad of android but with only selected numbers?

Is there a way to show numeric keypad of android but with only selected numbers?
Like i want to only show the numbers 2,4,6,8..all other numbers and signs should be blocked.
is there a way to do that in android?
Not really. I believe that you have the following options:
Create a custom keyboard
The most important downside is that each of your users would have to select your keyboard from system settings as the default.
Create a view, which looks like a keyboard
Probably the best approach, but the 'keyboard' most likely won't look like the native one.
Handle only the desired keys and ignore other.
If you can show all buttons and handle only a few of them - do that.
From the docs, there is a XML Attribute that should do the trick, but I have not tested it:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/yourEditTextId"
android:digits="2468"
android:inputType="number" />
The XML Attribute digits, which is inherited from TextView, is described as follows:
If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. If this is set, numeric is implied to be true. The default is false.

text entered in EditText does not change into password immediately

the password when entered by user does not change into * immedietly and plain text is displayed for 5 secs or so.I don't want this as my making a custom lock screen otherwise others can see the password entered.
I'm using
android:password="true"
kindly help
As far as I know this is how it is on all mobile platforms, and it's the "normal" way, because of the small, virtual keyboard you may introduce the wrong character. Nevertheless if you really want to modify that you'll have to create you own EditText, which will extend android's EditText.

Proper inputType for Credit Cards

I'm trying to devise an input type for a field which will accept credit card numbers.
I had been using inputType="number" - but that won't let people with hardware keyboards hit the space bar.. when they do it jumps to another field in the activity.
I'd like to allow users to use a space in their numbers if they want, or, at least, make it so that if users with a hardware keyboard hit the space when I'm only allowing numbers it won't leave the credit card number EditText.
Ideally I'd be able to implement some interface and have my own custom inputType, but I'm not sure that's possible.
Is it possible to allow numbers and spaces, while showing the numbers soft keyboard?
The best choise is InputType.TYPE_CLASS_DATETIME
How about android:inputType="phone" in your layout xml file?
I don't have a definitive answer for you but here are some resources I picked up:
I found this clue to "catch" hard key presses: "To intercept hard keys, override InputMethodService.onKeyDown()". Read from bottom heading "Intercepting hard key events".
If you can't find a way to intercept and deal with the "space" key, I would suggest using a normal TextView and manually opening the number keyboard rather than the qwerty one (Go here for more info on general Input Reference). You can then validate key pressed from the hard keyboard.
Sorry I couldn't give you a more solid answer!

How to force the Android Mobile keyboard to numbers?

Specifically, how do I get it to pop up as the numbers entry screen but still be able to switch to letters? What I'd really like, ideally, is to have it act the same as if we had the xml property
<EditText
...
android:inputType="textShortMessage"/>
but come up on the number entry screen (the one you get by clicking "?123") on first showing, rather than the usual qwerty one. I've tried doing eg
<EditText
...
android:inputType="textShortMessage|number"/>
but all that does is default it to the phone-number-entry screen with no option to enter letters. Any ideas?
In Java code, use:
edittext.setRawInputType(InputType.TYPE_CLASS_NUMBER);
This discussion seems to indicate that you can use:
android:inputType="number"
to achieve what you are looking for. But I think the poster of that solution may have misunderstood the problem, as I believe that "number" will only allow (of course) numbers, and not allow letters. I am not able to test this at the moment, so I will have to speculate.
Alternately, you could have two EditTexts for your input: one EditText strictly numeric, and the other plain text, such that you could enter a quantity in the first field and a unit in the second field. I'm guessing that you are eventually parsing the input as a string anyhow, and in that case all you would have to do is concatenate the text before parsing.

Categories

Resources