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
Post a Comment