Restricting characters in an EditText

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Restricting characters in an EditText

Postby tsucheck » Tue Nov 11, 2008 5:18 am

Hi,

I'm trying to restrict characters for the EditText Wiget. Basically I want only alphanumeric and few other symbols. I can do this by capturing input from the keyboard and block it that way but was wondering if anyone knows if Android provides a more automated way. Looking at EditText properties I only see digit and password, there is no property where I can specify allowed/restricted characters.

Any thoughts?

Thanks

T
tsucheck
Developer
Developer
 
Posts: 29
Joined: Sun Feb 17, 2008 2:07 am

Top

Postby Malefico » Tue Nov 11, 2008 8:23 am

With the digit property you define the allowed characters.

with "0123456789" only numbers

with "ABC" only these 3 characters
Malefico
Developer
Developer
 
Posts: 30
Joined: Fri Oct 24, 2008 3:32 pm

Postby tsucheck » Tue Nov 11, 2008 1:56 pm

Thats Great! Thanks a lot.
tsucheck
Developer
Developer
 
Posts: 29
Joined: Sun Feb 17, 2008 2:07 am

Postby Techno79 » Fri Dec 26, 2008 11:28 pm

How do I go about restricting an EditText so that it allows a float number with up to two decimal places of precision. Is there a built-in way to do this or will I have to do it manually by capturing events as the user types?

Thanks in advance.
Techno79
Freshman
Freshman
 
Posts: 6
Joined: Fri Dec 26, 2008 8:47 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests