结帖

learder 2017-03-22 11:07:25
This may help you. I face the same issue when writing the file on sdcard. I have set all required permission to write the file but I used the file object like below:

Wrong:

File myFile = new File(Environment.getExternalStorageDirectory().getAbsoluteFile()+fileName);

Correct:

File myFile = new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), fileName);

That means the path was wrong.

不用谢
...全文
631 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
开发者_android 2019-03-25
  • 打赏
  • 举报
回复
fei得更高 2019-03-23
  • 打赏
  • 举报
回复
后面那个是对的
chinahbbt 2017-03-22
  • 打赏
  • 举报
回复
ink_s 2017-03-22
  • 打赏
  • 举报
回复
寒冰大神 2017-03-22
  • 打赏
  • 举报
回复

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧