Android的ADT 21.0警告:隐式使用默认语言环境 [英] Android ADT 21.0 warning: Implicitly using the default locale

查看:202
本文介绍了Android的ADT 21.0警告:隐式使用默认语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经更新ADT到21节和新的警告出现在这code:

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 is a common source of bugs: Use toLowerCase(Locale) instead

所以我尝试:

So I try:

if (e.getMessage().toLowerCase(Locale.ENGLISH).contains("blabla"))

但错误依然存在!如何解决这个问题?

But error still remained! How fix this?

推荐答案

您应该使用 Locale.getDefault()特别是如果你不能确定你的文字永远是用英语。 另外像一个你有通常皮棉错误再次运行皮棉或清理项目后消失。

You should use Locale.getDefault() especially if you cant be sure that your text will always be in english. Also lint errors like that one you are having usually disappear after you run lint again or clean your project.

这篇关于Android的ADT 21.0警告:隐式使用默认语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆