java - Get the currency symbol based on country -


i have textview display currencies. default textview's text is: $0.00 how can make $ changes based on user selection.

i have following code:

locale locale=new locale("en", "us"); currency currency=currency.getinstance(locale); string symbol = currency.getsymbol(); toast.maketext(getactivity(), symbol, toast.length_short).show(); 

which shows $ if have following:

locale locale=new locale("en", "au"); currency currency=currency.getinstance(locale); string symbol = currency.getsymbol(); toast.maketext(getactivity(), symbol, toast.length_short).show(); 

it shows au$ instead of $

how can set currency symbol without stuff?

if want add format number have do

mystring = numberformat.getcurrencyinstance().format(mynumber); 

for default or

mystring = numberformat.getcurrencyinstance(new locale("en", "au")).format(mynumber); 

for specified


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -