例如,在它说Locale.setDefault()
设置Java虚拟机的这一实例的默认场所。
这不会影响主机地区。
由于Android OS(又名主机)不使用JVM,而是使用ART将Android应用程序编译到Dalvik字节码中,因此可以肯定地假设每个Android过程都是ART(或DVM?)实例,而不是JVM实例。这意味着执行Locale.SetDefault()在Android应用程序中不应产生效果,或者至少我假设。
我是否错过了与JVM有关的Android如何工作(或缺乏)?呼叫Java SDK方法会影响JVM实例,例如LoCale.SetDefault(Locale)对艺术实例也有任何影响吗?
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?
发布评论
评论(1)
否。
当您阅读
Java的Android Javadocs时。 。
No.
When you are reading Android JavaDocs for
java.*
andjavax*
classes, references to the JVM should be interpreted as including Android VMs (whether based on Dalvik or ART).