Wednesday, 15 July 2015

Phone number formatting an EditText in Android -


I am creating a simple Address Book app (Targeting 4.2) that includes a name, address, city, state, zip and phone Takes it.

I want to format the phone number input as a phone number (XXX) XXX-XXXX, but I need to drag the value as a string, so when I save it I Can I store this in my database? I have set the edit test for the "phone number" input but it does not do too much explicitly.

is a library that can help you with phone numbers conversion and comparison. For example, use ...

  EditText text = (EditText) findViewById (R.id.editTextId); PhoneNumberUtils.formatNumber (text.getText (). ToString ())   

... to format your number in a standard format. PhoneNews Utilities.com (String A, String B);

... helps with fuzzy comparison. See for a lot more.

Setting the p.s edit code to phones is already a good choice; Eventually it may be helpful to add numeral to your layout, it looks ...

  & lt; EditText Android: id = "@ + id / editTextId" Android: inputType = "phone" android: points = "0123456789+" />;    

No comments:

Post a Comment