问题描述
- android downloadmanager
- DownloadManager.getUriForDownloadedFile(id)返回值为null的具体原因是什么?
解决方案
DownloadManager是Android为开发者提供的一个后台应用组件,它通过Http层进行文件的下载任务.??? 1:使用???????? 首先要在AndroidManifest.xml中申请访问DownloadManager的权限????????? ???????? 添加一个下载任务:???????? ContentValues values = new ContentValues();......
答案就在这里:Android中的DownloadManager
解决方案二:
这是api level23中的解释, 除了下载成功 都会return null
public Uri getUriForDownloadedFile (long id)
Added in API level 11
Returns the Uri of the given downloaded file id if the file is downloaded successfully. Otherwise null is returned.
Parameters
id the id of the downloaded file.
Returns
the Uri of the given downloaded file id if download was successful. null otherwise.
时间: 2024-11-08 21:21:56