Android - 保存应用程序文件的目录的绝对URI

时间:2012-01-23 06:25:49

标签: android

我试图从服务器下载apk并将其安装在设备上(具有用户权限)。我尝试将下载的文件保存到我的应用程序目录 -

String appPath = MyApp.getContext().getFilesDir().toString() + '/' + fileName; File filePath = new File(appPath ); Uri auri = Uri.fromFile(filePath);

在3处抛出异常,说URI对于路径/data/data/com.mycompany.myapp/files/testfile.apk来说不是绝对的

但是,如果文件存储在“/mnt/sdcard/download/testfile.apk”之类的路径中,则可以正常工作。有什么想法吗?

0 个答案:

没有答案