Interface MediaHttpDownloaderProgressListener (2.1.2)

public interface MediaHttpDownloaderProgressListener

An interface for receiving progress notifications for downloads.

Sample usage:


 public static class MyDownloadProgressListener implements MediaHttpDownloaderProgressListener {

   public void progressChanged(MediaHttpDownloader downloader) throws IOException {
     switch (downloader.getDownloadState()) {
       case MEDIA_IN_PROGRESS:
         System.out.println("Download in progress");
         System.out.println("Download percentage: " + downloader.getProgress());
         break;
       case MEDIA_COMPLETE:
         System.out.println("Download Completed!");
         break;
     }
   }
 }
 

Methods

progressChanged(MediaHttpDownloader downloader)

public abstract void progressChanged(MediaHttpDownloader downloader)

Called to notify that progress has been changed.

This method is called multiple times depending on how many chunks are downloaded. Once the download completes it is called one final time.

The download state can be queried by calling MediaHttpDownloader#getDownloadState and the progress by calling MediaHttpDownloader#getProgress.

Parameter
Name Description
downloader MediaHttpDownloader

Media HTTP downloader

Exceptions
Type Description
IOException