我已经在AndroidManifest.xml中添加这一行到SD卡:不能写在Android模拟器
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
然而,当我运行代码写入到SD卡,我得到这个错误:
02-19 13:24:46.760: E/CameraTest(598): /mnt/sdcard/image.jpg: open failed: EACCES (Permission denied)
我该如何解决这个问题?
编辑:我正在使用添加了SDCard的Android模拟器。
EDIT 2:我知道问题是什么,现在我已经调用的函数Environment.getExternalStorageState()
,我得到“删除”。任何人都知道如何解决这个问题,并使状态MEDIA_MOUNTED
谢谢!
操作系统的任何设备上你有没有安装SD卡? – kosa 2012-02-19 18:32:08
检查[此] [1]和[此] [2] [1]:http://stackoverflow.com/questions/8854359/android-open-failed-eacces-permission-denied [2]:http://stackoverflow.com/questions/9334090/failed-to-save-image-to-sdcard – George 2012-02-19 18:32:50
@thinksteep:是的SD卡被添加。顺便说一句,我正在使用模拟器。 – 2012-02-19 19:44:13