How to read/write data to mounted sdcard
is there any way to write data to a sdcard when the card is mounted as a disc via usb?
I get an permission denied exception. If I unplug it everything is fine.
I know I should be using Environment.getExternalStorageDirectory, but I don't think this would make any difference.
Code:
File file = new File("/s开发者_StackOverflow中文版dcard/Test/test.txt");
BufferedOutputStream buf = new BufferedOutputStream(
new FileOutputStream(file,true));
buf.write(str.getBytes());
Thanks,
Nicholas
No, there isn't. Only one OS may use the sdcard(-partition) at any time.
精彩评论