Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java by Comparison (eBook) this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setting custom input type  RSS feed

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to have a custom input type for "EditText"? I want to allow numeric and also "% sign" and "/" and "*" but nothing else. If I set input type to "numberDecimal" then it does not allow other signs. How can I get those?

Thanks
Imad
 
Bartender
Posts: 19178
84
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's an option for that and I think it's called "digits". You list the allowable input characters, and I think it will give you what you want.
 
Ranch Hand
Posts: 127
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If I set input type to "numberDecimal" then it does not allow other signs. How can I get those?



setInputType as InputType.TYPE_CLASS_NUMBER , this will not allow user to entre *,# etc characters.. it will allow ONLY DIGITS.
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!