3

I want to get the currency name by country code. I get the country code with the following code:

    TelephonyManager manager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
    String countrycode=manager.getNetworkCountryIso();
    System.out.println("---->"+countrycode+"<----");

Now I want to get currency by using this country code. How can i do this?

joran
  • 169,992
  • 32
  • 429
  • 468
asha v
  • 2,039
  • 2
  • 15
  • 9
  • How many countries are you going for? Maybe you could have a if- or switch solution yourself? – Prof. Falken Oct 14 '11 at 10:17
  • Have you got an array of currency codes for each country? I am a php developer I dont know why this question got tagged in PHP. – Karthik Oct 14 '11 at 10:17
  • No I got only one code for a single device based on the network.It may be get by web services that time we have to use php thats why I tagged PHP. – asha v Oct 14 '11 at 10:24

2 Answers2

5

You can get the currency by using this util and load from country code.

http://developer.android.com/reference/java/util/Currency.html

heldt
  • 4,166
  • 7
  • 39
  • 67
-1

I've used the Currency class and the default Locale to get the current currency code (ISO 4217) with the following code:

Currency.getInstance(Locale.getDefault()).getCurrencyCode()

You can also replace the Locale with your custom Country Code ;)

Gnzlt
  • 4,383
  • 2
  • 22
  • 24