我一般放在res/里面,在res路径下新建一个raw文件夹,然后把你要用的文件放在raw文件夹里 可以用下面的一段代码把里面的文件读出来: public void readFile(){ try{ InputStream in = this.getResources().openRawResource(R.raw.文件夹名); byte[] data = new byte[20]; int len = in.read(data); tv.setText(new String(data,0,len)); in.close(); }catch(IOException e){
可以用下面的一段代码把里面的文件读出来:
public void readFile(){ try{
InputStream in = this.getResources().openRawResource(R.raw.文件夹名);
byte[] data = new byte[20];
int len = in.read(data);
tv.setText(new String(data,0,len));
in.close();
}catch(IOException e){
}finally{ }
}
但是我需要这个文件的路径String来使用,怎么才能得到路径