android - Android Studio 中的特殊符号

标签 android android-studio encoding

我使用的是 Eclipse,我没有这个问题:

IllegalDataException: Unable to serialize FindRecents state: The data "�" is not legal for a JDOM character content: Surrogate Pair Truncated.

我正在尝试复制一个特殊字符:🎧

当我复制它时,Android Studio 会输入:\uD83C\uDFA7

我已尝试将项目/文件编码设置为 utf-8,但这并没有改变任何内容,

如何在 Android Studio 中正确使用这个角色?

谢谢

最佳答案

您需要将表情符号的 Unicode 值显式转换为字符串。

您可以按如下方式轻松完成此操作:

//U+1F3A7 is the Unicode value of the Headphone emoji
int headPhoneEmoji = 0x1F3A7;

//Convert to string
String headPhoneString = new String(Character.toChars(headPhoneEmoji));

//Display it
myTextBox.setText(headPhoneString);

关于android - Android Studio 中的特殊符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34578038/

相关文章:

android - 如何更改 ListView 中的图像?

java - 安卓和微软 Access

android - 在 Android 中,如何解码 UTF-8 编码的字符串?

android - 从Flutter项目构建APK时出错

android - Android 应用程序中的 Google Product Sans 字体可以使用吗?

android - Google Cloud Endpoint - 项目运行后端配置时出错

python-3.x - python : What is this encoding and how to decode?

php - 如何在PHP中设置文本文件编码?

linux - 之前运行的Android Studio应用无法运行

python - read_csv 列编码