I am currently working on android project, I want to allow the user to hide or show their password on the screen by selecting a checkbox.
How would I go about replacing every character in the string with * character or is there a particular way to do this.
For example if the password is my_password I want it to be replaced with ***********.
You can use setTransformationMethod on TextView along with PasswordTransformationMethod to display stars.
Related
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.
I am trying to make an edittext into both a search bar and address bar. Also I am not sure how to allow the user hit enter on their keyboard to initiate the search instead of manually touching the go button.
It sounds like you want to use IME actions for your case to allow the user to have a sort of "Go" button which is activated by the enter key. This page on the official Android guide should help you: http://developer.android.com/guide/topics/ui/controls/text.html#Actions
To detect a URL, use the built in Java class to do it. See here: How to detect the presence of URL in a string
Using those two methods, simply check if the entered text is a URL. If it is, then use it, otherwise you call your search method passing in the entered text.
I have successfully created a custom key pad in my application but i am unable to find out how to display a dictionary of words like android default keypad which appear at the top whenever we type.
1st you need to take an AutoComplete TextView
Afterwards , you need to follow this example:
Creating a Search Interface
In this example the ListView's Data-Source is being changed when the text is entered in Search Bar.You need to change the Data-Source of AutoComplete TextView as the user enters different texts.
I hope this will solve your problem.
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.
I have placed an edit box and in that box the user has to type his email id and when he clicks a button it must be send to network.
When the user starts typing his name it gives some suggestions above the default keypad of the device, if the user selects one among them a small space appears after the name that gets selected.
If it is to be the last name no problem but if he is to type anything next to the word it goes on with a space and it creates problem in getting return data from network.
how to disable the the word suggestions....
Try textNoSuggestions value for the android:inputType attribute.
For example:
android:inputType="textFilter|textMultiLine|textNoSuggestions"
You need to set the input type to no suggestions. There is also an input type for email addresses. From 2.1 on, the input type can be set in the layout.