I've been researching for a solution to this issue for a while and could not find a proper solution. The closest I've got was this entry from stackoverflow. But since this was asked 4 years ago (and is not actually my issue although it could help to solve my problem), I 'll ask again to see if now there is a better workaround.
Context: I want to release my android app in several countries. Currently only available in Spain. I've read all android developers documentation about localization. It is pretty clear that all dynamic localized information on code should be based on "system locale" when presenting it to the user.
Problem: Problem comes when user changes language on settings manually and I want to display a price (generated by the app) that bases it's currency on system locale preference. For example lets say I live in Spain and I set up my device Language & input/Language to English(United States). When I do this my app shows prices in US dollars ($) but I want it to keep showing EUR (€) since I'm in Spain. How do I achieve this?
This is mi actual code for showing a "localized" price to the user based on system locale:
Locale currentLocale = Locale.getDefault();
priceFormat = NumberFormat.getInstance(currentLocale);
localCurrency = Currency.getInstance(current);
//...
//doubleValueCost is independent from currency but the I want to add the proper currency symbol
costTextView.setText(priceFormat.format(doubleValueCost) + " " + localCurrency.getSymbol());
This code will add the currency symbol for the system locale selected by user on preferences and not the actual currency symbol of the country where the device is.
Any advice is welcomed. Thanks in advance.