Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setting custom input type

 
Muhammad Imad Qureshi
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
 
Tim Holloway
Bartender
Posts: 18465
61
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.
 
Piyush Patel
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!