我在Emoji 5.0中有一个超过2000个emojis的文本文件。我的程序从文件中选择一行,然后将该行作为字符串返回。代码:
public String getLine() throws IOException{
AssetManager assetManager = getResources().getAssets();
//String[] files = assetManager.list("");
InputStream input = null;
try{
input = assetManager.open("words/words.txt");
} catch (IOException e){
System.out.println("Oops, something when wrong");
}
Random r = new Random();
int i1 = r.nextInt(max- min + 1) + min;
BufferedReader br = new BufferedReader(new InputStreamReader(input));
for(int j = 1; j < i1; ++j)
br.readLine();
final String lineIWant;
lineIWant = br.readLine();
return lineIWant;
}
然后将此字符串放在TextView:
中Button Button = (Button) findViewById(R.id.Button);
TextView ViewWord = (TextView) findViewById(R.id.GenWord);
final TextView finalViewWord = ViewWord;
final String[] Word = {null};
Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
//get the word
Word[0] = getLine();
//set the word
finalViewWord.setText(Word[0]);
//to keep Cody happy
} catch (IOException e) {
e.printStackTrace();
}
}
});
但是,当尝试渲染时,我得到了这个:
我想要的是在TextView中显示系统默认的表情符号,我不想使用表情符号。如果您需要包含所有表情符号的文件,那么我很乐意提供它。
编辑:这是我得到的错误:
08-05 18:26:14.671 17177-17253/com.ghostcode.emojio W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (4098x3660, max=4096x4096)
这里有一些示例表情符号:
☠️