【发布时间】:2015-07-26 19:24:54
【问题描述】:
我正在开发一个俄语版的 Android 应用。
这是我的AlertMessage 课程,其中只有一种方法和一个俄语单词:
public class AlertMessage {
public static boolean isYes (Context context, String header, String message){
final boolean[] isYes = {false};
new AlertDialog.Builder(context)
.setTitle(header)
.setMessage(message)
.setNegativeButton(android.R.string.no, null)
.setPositiveButton("Да",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
isYes[0] = true;
}
}).create().show();
return isYes[0];
}
}
我从MainActivity 调用它:
@Override
public void onBackPressed(){
if(AlertMessage.isYes(this,"Выход","Вы уверены, что хотите выйти из аккаунта?"))
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
App.super.onBackPressed();
Log.i("App", "Exit");
finish();
}
}
除了AlertMessage 类中的一个俄语单词外,一切正常。
这是不可读的。我该如何解决?
【问题讨论】:
-
不可读是什么意思?根本不显示?它是否显示错误的字符?你说的是标题、文本还是按钮文本?
-
@TimoSta 我说的是
AlertMessage中的单词。它的编码错误,这就是它不可读的原因 -
在strings.xml中外部化你的字符串
标签: java android utf-8 android-studio