Search code examples
javaandroidjvmdalvikandroid-runtime

Does calling Java's JVM instance-altering functions have any affects in an Android application?


For example, in Java's Locale class documentation it says that Locale.setDefault()

Sets the default locale for this instance of the Java Virtual Machine. This does not affect the host locale.

Since Android OS (aka the host) doesn't use JVM, and instead uses ART to compile Android apps into Dalvik bytecode, it's safe to assume that each Android process is an ART (or DVM?) instance and NOT a JVM instance. Meaning that executing Locale.setDefault() shouldn't have an effect inside an Android app, or at least I assumed.

Am I missing something with how Android works in relation to JVM (or lack thereof)? Does calling Java SDK methods that affect JVM instances such as Locale.setDefault(locale) have any affect on ART instances as well?


Solution

  • That would mean that executing Locale.setDefault() should have no effect whatsoever inside an Android app wouldn't it?

    No.

    When you are reading Android JavaDocs for java.* and javax* classes, references to the JVM should be interpreted as including Android VMs (whether based on Dalvik or ART).