I’m trying to implement some functions like file downloading which the download kickoff buttons lie in some list view. To make it more clear, here to illustrate it with graph.
First, I enter Book1_Activity with some list view there:
[book_chapter_name_1 [download_1]]
[book_chapter_name_2 [download_2]]
I clicked download_1 button, and the downloading is kicked off and there is a progress bar which shows the degree of the progress. The downloading is achieved by an AsyncTask.
After that, I’d like to switch to some other activity, let’s say book_read_activity, so that I could download some books while keep reading still.
My problem is after I read the book, when I’d like to check the progress of the downloaded books, so I reentry the Book1_Activity, since Book1_Activity is destroyed and recreated, how could I get the download progress and update it?
Considered using a service instead? Then you could have it running even if closed?
But if you want to go on with your approach I’d have the asynctask write progress to a global access point and then read progress from there.