Android ADT 21.0 warning: Implicitly using the default locale

后端 未结 6 1445
感情败类
感情败类 2020-12-29 19:38

I\'ve updated ADT to v. 21 and new warning appeared in this code:

if (e.getMessage().toLowerCase().contains(\"blabla\"))

Implicitly using the default locale         


        
6条回答
  •  星月不相逢
    2020-12-29 19:51

    Actually, use Locale.getDefault() when the goal is to present text to the user. However, and this is the whole point of the Lint check, you should probably be using Locale.US whenever the goal is for machine readability/usage. Because it is already implicitly using Locale.getDefault() if you don't specify one, and this can cause hard to find bugs when devices have their own default locale specified. It seems that you also need to clean your project either way, as everyone else has suggested.

提交回复
热议问题