text entered in EditText does not change into password immediately - android

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.

Related

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 to remove calculator buttons from numeric keypad

The input type for my EditText control is set to "number." When the numeric keypad is displayed, besides showing the numbers, it also shows calculator keys (+/-/etc.). I am wondering if there is any setting to remove the calculator keys.
Thank you in advance for your help.
If all you need are actual numbers 0-9 you could set your keyboard type to "phone" instead of "number" which should give you a more 9-pad style keyboard that probably won't contain the extra keys like +, - etc...
However in the end it is up the currently running keyboard application (which is chosen by the user) If whatever keyboard they happen to be using shows keys that you would rather it not, there is generally no way for you to instruct it not to show those keys.
If you want to have complete control over the input then you'll have to create your own View that mimics the functionality of the keyboard and "manually" insert the typed characters into your EditText.
Add this line of code
input.setInputType(InputType.TYPE_CLASS_NUMBER);
Hope it helps.

lock android keyboard to only show numerics

I have an android app that uses an EditText with android:inputType="number"
when the edittext first displays the softkeyboard appears with only numerics enabled (you can still see the other keys though.
The EditText also has android:digits="0123456789\n" as I want the users to be able to enter multiple lines
As soon as I hit the ENTER key to create another line the numeric keys disappear.
How can I...
a). Only show a numeric keyboard (with Enter key) e.g. just 0123456789?
b). Stop the softkeyboard showing all the other keys?
You want a multiline EditText and numeric keyboard? Seems possible, but deprecated. Check out this answer.
Update:
If everything fails, try to enforce the numeric type every time a line break is inserted:
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
Found a solution
by employing
android:digits="0123456789\n"
android:inputType="phone|textMultiLine"
I obtain the desired effect.
Try this
editTextField.setRawInputType(Configuration.KEYBOARD_QWERTY);
This shows the normal key pad with the numeric version first, yet allows you to switch between them.
getInput.setRawInputType(Configuration.KEYBOARD_12KEY);

How do I default to numeric keyboard on EditText without forcing numeric input? [duplicate]

This question already has answers here:
EditText with number keypad by default, but allowing alphabetic characters
(19 answers)
Closed 9 years ago.
This has been asked elsewhere online to no avail. Is there any way in Android to display the numeric soft keyboard when focusing on an EditText, but still allow any text to be entered?
I'd like to let the user enter quantities (e.g. "1 kg", "2 L"), so just setting inputType="number" won't work.
Add the following line of code, and it will do the trick :)
editText.setRawInputType(Configuration.KEYBOARD_QWERTY);
This will show the the numeric keypad first, but also allows you to enter free text.
More information here.
This may be device dependant but have you tried:
android:inputType="phone"
All Input Types Link
in the EditText's xml , this gives you the number pad keyboard but then you can still switch to letter's if you want. (Atleast on my Nexus One).
Note that: setRawInputType(InputType.TYPE_CLASS_NUMBER);
has the desired effect on some devices but not others...
On htc it works fine however on galaxy tab II you only get the numeric keyboard and no way to switch back to alpha.
write the code in XML,
android:numeric="integer"
android:inputType="phone"
android:digits="1234567890"
It looks like the underlying question you're dealing with is: how can I allow the user to enter quantities?
One appropriate answer is: with a numeric input, paired with some form of category select for the unit. e.g. radio, dropdown, or spinner. This is probably easier to use and also saves you the headache of having to validate your input every time.
You could also just have iron cojones and write a custom soft keyboard.
I tried many different combinations before I figured this out, but this appears to work correctly:
setRawInputType(InputType.TYPE_CLASS_NUMBER);
The key lies in the description for setRawInputType(int):
Directly change the content type integer of the text view, without
modifying any other state.

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