内部存储在HTC Desire上
|
我正在尝试将文件保存到内部存储(不是SD卡)。正如文档所指出的那样,如果我使用“ 0”,则数据将放在“ 1”之下,但是那里什么也没有。此代码是从这里获取的。不过,类似的代码也适用于Archos。
File path = Environment.getExternalStorageDirectory();
File file = new File(path, \"DemoPicture.jpg\");
txtList.append(file.getPath());
try {
path.mkdirs();
InputStream is = getResources().openRawResource(R.drawable.icon);
OutputStream os = new FileOutputStream(file);
byte[] data = new byte[is.available()];
is.read(data);
os.write(data);
is.close();
os.close();
} catch (IOException e) {
Log.d(\"ExternalStorage\", \"Error writing \" + file, e);
}
我使用的是Android SDK 2.1。清单中已经添加了权限“ 3”。 logcat中没有错误。有什么提示吗?
没有找到相关结果
已邀请:
2 个回复
先对冈蒲
生成的文件将位于此处:“ 5”。但是,如果您真的想使用内部存储,请查看
函数。 编辑: 文件路径= Environment.getExternalStorageDirectory(); 文件文件=新文件(路径,\“ DemoPicture.jpg \”); txtList.append(file.getPath());
铰齐插