以前做1.5版本的程序,没有这个问题,2.2的版本用同样的代码一直写不了,纳闷。。
想起看程序权限时,都有写入文件的权限,所以估计是需要明确的权限。

引用一些别人的问题:

You're right that the SD Card directory is /sdcard but you shouldn't be hard coding it. Instead, make a call to Environment.getExternalStorageDirectory() to get the directory:

File sdDir = Environment.getExternalStorageDirectory();


If you haven't done so already, you will need to give you app the correct permission to write to the SD Card by adding this to your Manifest:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


from: http://stackoverflow.com/questions/2121833/permission-to-write-to-the-sd-card


原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
Tags:
brass casting Homepage Email
2010/11/10 16:22
原来是权限惹得祸,谢谢博主提醒。
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemotemotemotemotemotemotemotemotemot
emotemotemotemotemotemotemotemotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写
 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐