Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ADT 21.0 warning: Implicitly using the default locale

Tags:

android

adt

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?

like image 857
rocknow Avatar asked Nov 18 '12 21:11

rocknow


2 Answers

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.

like image 125
Gabriel Netto Avatar answered Nov 09 '22 13:11

Gabriel Netto


You simply need to clean your project by clicking:

Build > Clean Project or Build > Rebuild Project

like image 34
Mahorad Avatar answered Nov 09 '22 14:11

Mahorad