Android原始资源.txt显示符号

时间:2015-03-05 19:52:15

标签: java android android-resources

我尝试使用原始资源文件夹来存储文本文件。 (而不是硬编码)。 文本是希伯来文,所以它是RTL(我不认为这是问题所在)。 问题是,我没有内部的文字,只有符号。(����。)

这是我在资源文件

中获取文本的方法
 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();
    }

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

我找到了解决方案...... 删除文件并重新放置。 如果失败,请尝试手动粘贴数据(CTRL + V)。