android


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!

Related Links

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?

Categories

HOME
notepad++
paraview
deep-learning
android-studio-2.2
obfuscation
r-googlesheets
zip
pearson-correlation
nuget-package
python-multithreading
iis-6
computer-science
extjs4.2
fosrestbundle
distribution
activecollab
why3
ycsb
flash-player
symfony-2.8
standards
asp.net-mvc-viewmodel
html5-appcache
articulate-storyline
imageresizer
epsilon
displaytag
interpreter
shared
ms-access-web-app
asymptotic-complexity
mat
tpm
carrierwave
uitapgesturerecognizer
google-cast
card.io
carriage-return
swagger-php
zoomify
ideascript
metawidget
doc
microsoft-metro
chronicle-map
tcc
snapchat
ntvs
globalize
netbeans6.8
datamaps
reindex
compiler-design
filehandle
otp
django-1.10
vcloud-director-rest-api
segment-io
mongodb-php
jquery-jscrollpane
google-query-language
cassia
dbamp
phpwebsocket
cortex-m
pushbots
design-principles
phpgrid
opl
tfs-workitem
java-money
iokit
lazybones
django-urls
intel-c++
text-search
sha512
graphics2d
node-serialport
osc
execve
post-commit-hook
punycode
machine-instruction
gae-quotas
asdf
abstract-data-type
asplinkbutton
resource-management
device-width
dopostback
josql
appledoc
eclipse-marketplace
scrollbars
lobo-cobra
todos
fdf

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App