我的文字没有显示

时间:2017-06-02 14:47:47

标签: java android file text

我有一个我想要显示的文本文件。当我运行应用程序时,只显示一个白色的屏幕,没有文字。

String text = "";

try {
       InputStream is = getAssets().open("matthieu.txt");
        int size = is.available();
        byte[] buffer = new byte[size];
        is.read(buffer);
        is.close();
        text = new String(buffer);
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    textView_mat.setText(text);

0 个答案:

没有答案
相关问题