Android Question Device Language

Guenter Becker

Active Member
Licensed User
Hope you are all fine,

today I need help to find a small B4A-Code snipped to change the language of a connected device (for example via B4XBridge or Emulator).
It's just to test apps on devices with different languages. I looked for AHlocale and Localizator but that is no what I'm looking for.
I think it will go into direction of using a java object but I do'nt no the parameters and exactly how to code.

Thanks for your help and stay well.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can change the default locale of your app. You cannot the global setting.

 
Upvote 0

Guenter Becker

Active Member
Licensed User
Thank you Erel,
I know this code and I tested it. But ervery way I choose with the locale code (GE, DE, de a.s.o) I am getting the error that the country code ist not known.
But it is good to know that there is no way to change the device language by code. Does'
nt matter I will find an another way. Stay well. Günter
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
But it is good to know that there is no way to change the device language by code.
@Guenter Becker try it:

B4X:
Dim jo As JavaObject
jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(jo.GetField("GERMANY")))
' or jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(jo.GetField("GERMAN")))

It is always helpful to read the documentation before jumping to conclusions. For some languages the abbreviation is good for others it is necessary to write in full.

Here are the tables and explanations


 
Last edited:
Upvote 0
Top