java - Android Convert Currency TextView Back To Double -



java - Android Convert Currency TextView Back To Double -

i have textview called cardbalance

cardbalance = (textview) findviewbyid(r.id.textviewcardbalance);

and set text cardbalance so

double amount = 109.00; numberformat baseformat = numberformat.getcurrencyinstance(); string moneystring = baseformat.format(amount) cardbalance.settext(moneystring);

this works fine , displays $ symbol desired, struggle how value , covert double?

i tried next without success

double bal = double.parsedouble(cardbalance.gettext().tostring());

how can double value without $ symbol

a numberformat object can used parsing formatting.

documentation numberformat.parse()

parses number specified string using rules of number format.

so, utilize baseformat.parse(cardbalance.gettext().tostring())).doublevalue();

java android number-formatting

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -