开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜