我正在尝试一个简单的检查。如果字符串名称语言环境具有“es”作为值。
public String locale =
Locale.getDefault().getLanguage().toLowerCase().toString();
// ...
Log.v(tag, "Idioma del sistema: «" + locale +"»");
if (locale != "es") {
showDialog(R.string.warningTitleDialog,
"We are sorry that this tool is only available in Spanish " +
"language. See Author menu item for more information. [" +
locale + "]");
locale = "en";
}
adb logcat
将“es”显示为字符串“locale”的内容,但条件内的代码正在执行。