如何使用下載管理器下載的base64圖像(我的意思是圖像必須在應用程序下載,顯示下載(base64轉換爲字節後文件保存))如何使用DownloadManager下載base64圖像?
例如: 我需要從下一個我的自定義瀏覽器加載圖像html "<img src=\"data:image/jpeg;base64,someBase64String" />"
。並加載它完全相同(用戶意見)作爲一個正常的圖像網址。對於正常的圖片url,我使用DownloadManager:
DownloadManager.Request request = new DownloadManager.Request(source);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
request.setTitle(fileName);
request.setDescription(fileName);
DownloadManager dm = (DownloadManager) App.getInstance().getSystemService(Context.DOWNLOAD_SERVICE);
dm.enqueue(request);
源代碼此類(請求)拋出異常,如果我們把不遠程uri – mlevytskiy
http://grepcode.com/file/repo1.maven.org/maven2/org.robolectric/android-all/4.4_r1-robolectric -0/android/app/DownloadManager.java#DownloadManager.Request – mlevytskiy
if(scheme == null ||(!scheme.equals(「http」)&&!scheme.equals(「https」))) – mlevytskiy