[英]Unmappable character for encoding UTF-8 in Android Studio
I'm developing an Android app in the Russian language. 我正在用俄语开发一个Android应用程序。
Here is my AlertMessage
class with only one method and one Russian word within: 这是我的
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];
}
}
And I call it from the MainActivity
: 我从
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();
}
}
Everything work fine except one Russian word in AlertMessage
class. 一切正常,但
AlertMessage
类中只有一个俄语单词。 It is unreadable. 这是不可读的。 How can I fix it?
我该如何解决?
您可以使用诸如getString(R.string.error_msg)
类的资源中的字符串而不是硬编码的字符串来修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.