I have an application that has an initial activity that lists some files in a list. When an item is clicked on a list, it moves on to the detailed action of that particular file.
In the detailed view, I have a button called download, when you click on download, it launches IntentService, which sets the file to load as such:
downloadButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(AppDetailsActivity.this, AppDownloadService.class); intent.putExtra(Consts.APP_DOWNLOAD_RECEIVER_KEY, new DownloadReceiver(new Handler())); startService(intent); } });
The DownloadReceiver class is used to update the progress bar in the detailed description of the downloaded file.
Now what I want to do ...
If the user is currently downloading a file from a detailed action and then returning to the previous action, I want the activity to somehow sign / bind to the same IntentService and retrieve the results so that it can display a progress bar in the list item of the downloaded file.
- Is this possible with IntentService?
- Is IntentService correct?
- Are there any examples (since I did not find anything that would show me how to do this)?
source share