我的应用程序将下载非媒体文件,如PDF,TXT,XML等。使用下面的代码,我保存在存储。
FileOutputStream out = new FileOutputStream("Save locaation");
final int fileBufferSizee = 1024;
byte[] buffer = new byte[fileBufferSizee ];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
in.close();
in = null;
out.flush();
out.close();
out = null;工作得很好。实际上,我需要保存文件的URI。为此,我需要在android媒体数据库中插入信息。
如何在android媒体数据库中插入非媒体文件?有什么建议吗?
发布于 2013-11-28 10:14:40
如果您想从绝对路径获取URL,那么请执行以下操作
Uri.parse(new File("/sdcard/cats.jpg").toString()));将其保存在一个URI变量中
https://stackoverflow.com/questions/20262958
复制相似问题