Java Android raw resource.txt显示符号
我尝试使用原始资源文件夹来存储文本文件。 而不是硬编码。 文本是希伯来文,所以是RTLI,我不认为这是问题所在。 问题是,我只得到了符号,而不是里面的文本。����. 这就是我获取资源文件中文本的方式Java Android raw resource.txt显示符号,java,android,android-resources,Java,Android,Android Resources,我尝试使用原始资源文件夹来存储文本文件。 而不是硬编码。 文本是希伯来文,所以是RTLI,我不认为这是问题所在。 问题是,我只得到了符号,而不是里面的文本。����. 这就是我获取资源文件中文本的方式 InputStream inputStream = this.getResources().openRawResource(id); byte[] buffer = new byte[1024]; int bufferLength = 0; String name =
InputStream inputStream = this.getResources().openRawResource(id);
byte[] buffer = new byte[1024];
int bufferLength = 0;
String name = getNameByID(id);
FileOutputStream fos = openFileOutput(name,MODE_PRIVATE);
try {
while ((bufferLength = inputStream.read(buffer)) > 0){
fos.write(buffer,0,bufferLength);
}
} catch (IOException e) {
e.printStackTrace();
}
有什么建议吗?我找到了解决办法。。。 删除文件并将其重新放置。 如果失败,尝试手动粘贴数据LYTRL+V