Android: How to set culture values for application
) i'm a C# developer and now i started to program apps for android. In C# we have the CultureInfo object where we can set the values for the culture of the aplication. There is a similar object in java (android) to let me do that ¿? i found that i can set the locale with this Locale.setDefault(Locale.FRENCH); but how i set the date, number adn monetaris symbols ¿? Here is the code in C# that i use: CultureInfo objCultureInfo = new CultureInfo("en-US", true); objCultureInfo.NumberFormat.NumberDecimalDigits = 2; objCultureInfo.NumberFormat.NumberDecimalSeparator = "."; objCultureInfo.NumberFormat.NumberGroupSeparator = ","; objCultureInfo.DateTimeFormat.DateSeparator = "/"; objCultureInfo.DateTimeFormat.TimeSeparator = ":"; objCultureInfo.DateTimeFormat.FullDateTimePattern = "MM/dd/yyyy HH:mm:ss"; objCultureInfo.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy"; objCultureInfo.DateTimeFormat.ShortTimePattern = "HH:mm:ss"; objCultureInfo.NumberFormat.CurrencySymbol = "$"; Cultura.CulturaAplicacion = objCultureInfo; Thanks!
In my opinion you shouldn't change the Locale value at all. The user sets this value device wide in the settings. You can also set your date and time format there, too. You should use those values in your app instead of overriding them with custom ones, because the user knows better, which language and formats he/she wants to use.
I think I found what I needed here: http://developer.android.com/reference/java/text/NumberFormat.html Thanks!
nine-patch images with 1px width or height — special case or faulty files?
Android Pinch Zoom ImageView (PhotoView) with ScrollView
How to set TextView by XML
progressDialog and AsyncTask
Widget with buttons opening applications
Remove OnScrollChangedListener from ViewThreeObserver
AVD will not launch on Ubuntu 14.04
Use activity with include tag on android
add image information bitmap to jpeg
Save files locally, but prevent them from showing up in the users file manager
Cordova cannot add Android failed with exit code ENOENT
Compare two voice in android
Share Intent destroying app after backclicked
Mobile data is not turning off programmatically
Where is this “overflow menu button” in Android Studio?
How to start an activity if the power button is pressed (x) no of times in my android app?