0

In my application, this snippet:

Local.getDefault().getCountry() 

At the very soon when application launches, it returns the correct value like FR/CA/GB/US. But after a few moment it returns an empty string. (in detail: we have a language param for our https request, we need to different fr_FR, fr_CA, en_US, en_CA...)

How to achieve the value of language correctly? (fr_FR, en_CA,...)

Some same domain but not identical topic:

Locale.getDefault().getCountry() returning empty string -> this question is not yet answered

java.util.Locale has an empty first item

Tested and found this unusual problem in reals devices: Android 6.0, 8.0, 9.0

Anh-Tuan Mai
  • 1,129
  • 19
  • 36
  • 2
    Do you have code that would call `Locale.setDefault()` to replace the default locale? It might also be in a library you're using. – laalto Aug 05 '20 at 13:35
  • Thank you so much, it is placed in a library we are using ( ImagePicker ). I shall post a issue on that. – Anh-Tuan Mai Aug 05 '20 at 13:55

1 Answers1

1

Thanks to laalto

I found the problem is in a library: Locale.setDefault() was called. In my case, it was ImagePicker.

Anh-Tuan Mai
  • 1,129
  • 19
  • 36