简体   繁体   English

带有进度对话框的Android TV DownloadManager

[英]Android tv DownloadManager with progress dialog

I'm struggling with DownloadManager on androidtv, I finally could implement download with the download manager, but I don't know the progress of the download process until it finishes, I would like implement download progress dialog. 我在androidtv上与DownloadManager苦苦挣扎,终于可以通过下载管理器实现下载了,但是直到完成后我才知道下载过程的进度,我想实现下载进度对话框。

I found the following link DownloadManager with notification but I don't know how to implement it. 我发现以下带有通知的DownloadManager链接但不知道如何实现。

Hope you could help. 希望您能提供帮助。

Since you already were able to implement downloading using DownloadManager , you may try adding a COLUMN_BYTES_DOWNLOADED_SO_FAR constant to get the number of bytes downloaded so far. 由于您已经能够使用DownloadManager进行下载 ,因此您可以尝试添加COLUMN_BYTES_DOWNLOADED_SO_FAR常量以获取到目前为止已下载的字节数。

You may get ideas on how implementation should be done from the solutions given in the following SO posts: 您可以从以下SO帖子中给出的解决方案中获得有关应如何实施的想法:

Another option that you may try is to use ProgressDialog . 您可以尝试的另一种选择是使用ProgressDialog As mentioned in the documentation, it functions as 如文档中所述,它的作用是

A dialog showing a progress indicator and an optional text message or view. 一个显示进度指示器和可选文本消息或视图的对话框。

To help you with the implementation part, please check the brief but comprehensive solution given in this SO post - Download a file with Android, and showing the progress in a ProgressDialog . 为了帮助您实现部分,请检查此SO中提供的简短而全面的解决方案。 用Android下载文件,并在ProgressDialog中显示进度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM