如何读取/写入已安装的SD卡的数据

Nic*_*las 1 android

当卡通过USB安装为光盘时,有没有办法将数据写入SD卡?

我获得了许可拒绝例外.如果我拔掉它一切都很好.

我知道我应该使用Environment.getExternalStorageDirectory,但我不认为这会有任何区别.

码:

        File file = new File("/sdcard/Test/test.txt");

        BufferedOutputStream buf = new BufferedOutputStream(
                 new FileOutputStream(file,true));

         buf.write(str.getBytes());
Run Code Online (Sandbox Code Playgroud)

谢谢,

尼古拉斯

Lox*_*ley 5

不,没有.任何时候只有一个操作系统可以使用sdcard(-partition).