久久ER99热精品一区二区-久久精品99国产精品日本-久久精品免费一区二区三区-久久综合九色综合欧美狠狠

新聞中心

EEPW首頁 > 嵌入式系統 > 設計應用 > android從資源文件中讀取文件流顯示

android從資源文件中讀取文件流顯示

作者: 時間:2016-09-12 來源:網絡 收藏

1. Java]代碼

本文引用地址:http://cqxgywz.com/article/201609/305203.htm

private void doRaw(){

InputStream is = this.getResources().openRawResource(R.raw.ziliao);

try{

doRead(is);

}catch(IOException e){

e.printStackTrace();

}

}

private void doRead(InputStream is) throws IOException{

DataInputStream dis = new DataInputStream(is);

byte[]buffer = new byte[is.available()];

dis.readFully(buffer);

textView.setText(new String(buffer));

dis.close();

is.close();

}

//就是用this.getResources().openRawResource這個就可以了



關鍵詞:

評論


相關推薦

技術專區

關閉