文件的读写操作

推荐安卓开发神器(里面有各种UI特效和android代码库实例)

1.在android下创建一个android.txt 文件

    FileOutputStream fos = this.openFileOutput("android.txt",MODE_APPEND);
    String str="1234";
    byte [] temp = str.getBytes();
    fos.write("".getByte());
    fos.flush();
    fos.close();


    .........................

2:在android下读取上面创建的文件

   FileInputStream fis = this.openFileInput("android.txt");
// 读取android资源下的文件 必须在res下建一个raw文件夹 放入一个文件 android.txt

   InputStream is = getResource().openRawResource(R.raw.android);

 

你可能感兴趣的:(java,android)