0

I've been following the guide on implementing APK expansion files, and I've hit a bit of a snafu with the Downloader Library (example implementation, which I've been following). The IDownloaderClient interface has the following method defined:

onDownloadProgress(DownloadProgressInfo progress)

The download service calls this to deliver a DownloadProgressInfo object, which describes various information about the download progress, including estimated time remaining, current speed, overall progress, and total so you can update the download progress UI.

This is implemented as:

    @Override
    public void onDownloadProgress(DownloadProgressInfo progress) {
    mAverageSpeed.setText(getString(R.string.kilobytes_per_second,
            Helpers.getSpeedString(progress.mCurrentSpeed)));
    mTimeRemaining.setText(getString(R.string.time_remaining,
            Helpers.getTimeRemaining(progress.mTimeRemaining)));

    progress.mOverallTotal = progress.mOverallTotal;
    mPB.setMax((int) (progress.mOverallTotal >> 8));
    mPB.setProgress((int) (progress.mOverallProgress >> 8));
    mProgressPercent.setText(Long.toString(progress.mOverallProgress
            * 100 /
            progress.mOverallTotal) + "%");
    mProgressFraction.setText(Helpers.getDownloadProgressString
            (progress.mOverallProgress,
                    progress.mOverallTotal));
    }

The problem is, no matter what I do I simply cannot get my downloader UI to update. I've tried invalidating, postInvalidating, running in a separate thread, etc. If I've overlooked some key portion of the sample implementation, please point it out to me, but I can't seem to find it. I've poured over my code and over the sample all day... Any ideas why I can't get the UI to update? It's literally the last thing keeping me from publishing my app. Thanks.

Andy G
  • 19,232
  • 5
  • 47
  • 69
monkey0506
  • 2,489
  • 1
  • 21
  • 27
  • Are you sure, your `onDownloadProgress` gets called? – Henry Aug 31 '13 at 07:20
  • Yes, I'm definitely sure it gets called. I'm able to log the data from the DownloadProgressInfo, but I just cannot get the UI to reflect *any* changes. It won't even reflect the "last" change, it simply never updates ever. – monkey0506 Aug 31 '13 at 13:43

1 Answers1

0

Well, this is frustrating, but technically I've got the UI updating. The problem is that I have no idea what's different now as opposed to how it was before.

What I did is I deleted the entire layout and created a new one from scratch. I may have changed something in the code, but as many things as I've been randomly trying, it's hard to say what finally did the trick. If anyone else has a similar problem, I'd suggest deleting the layout and starting over...I guess.

Any further feedback, suggestions, or info would be nice too though.

monkey0506
  • 2,489
  • 1
  • 21
  • 27
  • having the exact same issue, does anyone maybe have any other suggestions or feedback, without deleting the entire layout? – Bohrend May 23 '17 at 08:03