Roger
Roger

Reputation: 4259

Real-time calc of editText?

I have an editText that brings up the number keyboard. When you enter a number in, I want it to perform a calculation before it shows up in the box.

So the box initially reads $0.00, you click on it, hit 5, it does a calculation and shows up in the box as $0.05, if you then hit 4 it shows up as $0.54, hit 3 and it's $5.43, etc.

From what I understand, an addTextChangeListener TextWatcher is needed. I have one... but I don't understand how to manipulate the data before it appears in the box. I'm also having troubles with math calculations on what the TextWatcher provides. Can somebody please point me in the right direction?

Upvotes: 2

Views: 568

Answers (1)

thoredge
thoredge

Reputation: 12591

This one's got some options: Android Money Input with fixed decimal

Upvotes: 2

Related Questions