Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple EditText currency formatter [duplicate]

Possible Duplicate:
Better way to Format Currency Input editText?

The problem is simple and basic... but I can't find a decent way of handling it. I have some fields with money values and I need to have both the currency symbol and the decimal value. Here is what I am talking about:

enter image description here

The user will input the value: 1 and then . and then 8 and then 0. The EUR symbol I want it to be visible all time.

What's the best way of achieving this ?

like image 803
Alin Avatar asked Apr 24 '12 12:04

Alin


2 Answers

Try to use a textwatcher :D

http://developer.android.com/reference/android/text/TextWatcher.html

Better way to Format Currency Input editText?

With this u can format the incoming String before its display, so u can easily append a "€" and other stuff

like image 53
Thkru Avatar answered Nov 16 '22 06:11

Thkru


You can achieve that by using a TextWatcher. Look at this Question which is quite similar to yours.

like image 1
Renard Avatar answered Nov 16 '22 07:11

Renard