判断方法为:
public static boolean isZh(Context context) {
Locale locale = context.getResources().getConfiguration().locale;
String language = locale.getLanguage();
if (language.endsWith("zh"))
return true;
else
return false;
}
应用举例比如:
if (isZh(MainActivity.this)){
Toast.makeText(MainActivity.this,
"没有视频了,请检查网络,一会儿再试.",
Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(MainActivity.this,
"Videos could not be shown right now. Please try again later.",
Toast.LENGTH_SHORT).show();
}