【发布时间】:2018-05-13 13:42:39
【问题描述】:
我在 Android Studio 中使用 webView 制作了应用程序,我的应用程序包含所有图像,所以我还在我的应用程序中实现了下载按钮,但是当有人点击下载按钮时它只是下载图像,我想在下载时显示弹出窗口完成了,像这样的, 下载完成并在确定按钮下方
这是我的下载代码
Uri source = Uri.parse(url);
// Make a new request pointing to the .apk url
DownloadManager.Request request = new DownloadManager.Request(source);
// appears the same in Notification bar while downloading
request.setDescription("Description for the DownloadManager Bar");
request.setTitle("PunjabiDharti.jpg");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
// save the file in the "Downloads" folder of SDCARD
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "PunjabiDharti.jpg");
// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
如何显示弹出窗口?
【问题讨论】:
标签: android android-studio download download-manager