rajvir singh
rajvir singh

Reputation: 111

How to make edittext in android always have 2 decimal digits regardless of the value entered by the user?

I want my edittext to always have 2 decimal places at the end regardless of the value entered by the user. How to accomplish this. Tried setting it with aftertextchanged method but it goes into an infinite loop.

Upvotes: 0

Views: 3477

Answers (1)

Rose
Rose

Reputation: 176

Set android:inputType="numberDecimal" No predefined function to set the limit for the edittext to How many digit it should accept after the decimal point from user. We can achieve this by using TextWatcher. Please check the link given below

http://v4all123.blogspot.in/2013/05/set-limit-for-fraction-in-decimal.html

Upvotes: 1

Related Questions