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

HTC BLE problems and kontakt.io beacons api
Firebase query with wrong data doesn't give any call back [duplicate]
Android click Highlight issue: After updating to Android studio 2.2 preview 3
Android Studio - using webView.findAllAsync(text) to highlight text on website and then creating on click action on text
formatting text inside an array
android how to avoid this out of memory error
android- How to make screen helpers [closed]
DragonFly Black DAC connected with a Samsung Galaxy phone
Uber RideRequestButton gets stuck at “Requesting”
Android permissions are not getting updated even according to manifest.xml
File size written with getExternalFilesDirs to SD card are listed on internal memory
rounded Imageview in android eclipse?
Change textcolor of a custom ListView
android : communication myservice with other apps activity
textView border radius from right more than left
PreferenceCompatFragment null pointer when setting OnSharedPreferenceChangeListener

Categories

HOME
hyperlink
delphi-7
webdriver
css3
android-studio-2.2
formal-languages
requirements
nuget
appcelerator
seo
x264
computer-science
siddhi
mautic
comsol
zerobrane
http-post
event-sourcing
azure-iot-hub
dynamic-sql
forgot-password
soci
windows-xp
undertow
rubymotion
r-mice
qliksense
resourcebundle
jquery-callback
xunit
game-theory
tiki-wiki
firebase-analytics
handler
google-earth
xbox
recurring-events
anki
python-2.6
cognos-bi
left-join
biztalk-rule-engine
carriage-return
nested-lists
indy10
apic
nohup
z-notation
node-mssql
setup.py
chronicle-map
bindingnavigator
tcc
knime
file-sharing
show-hide
page-replacement
opengl-4
skin
pdf-conversion
android-instrumentation
stripe-connect
usart
cudd
pure-css
simplepie
hadoop-2.7.2
qtplugin
model-associations
drawstring
expectations
eigenvector
riot
angular-ui-typeahead
createprocess
database-relations
false-sharing
mobiledoc-kit
phpgrid
spring-retry
roadkill-wiki
morton-number
intel-c++
ons-api
avahi
fits
adehabitathr
ghcjs
linkedin-jsapi
xml-dsig
getopt
syndicationfeed
eclipse-kepler
jeromq
cffile
nebula
abstract-data-type
swfobject
pdfviewer
dopostback
paginator
fusefabric
procedures
strsep
binomial-heap
product-management
dsoframer
pbcopy

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