In my application, I need to download files from URL locations. I want to show the download progress in a dialog box (or, optionally, in the notification area). I came across several good resources on this subject (something like http://progrnotes.blogspot.com/2010/09/c-android.html ). Unfortunately, all the examples do not give a clear indication of how to correctly cancel the download at the user's request. So my question is actually quite simple:
Given an asynctask that downloads a file in the background (using httpclient) and displays a download dialog and a cancel button, how do I cancel the download and stop the background task when the button is clicked?
I know that killing threads are generally not a good idea, so I will probably have to work with the "cancel" variable in my background thread. How to transfer a stop signal from a button to asynthesis?
Regards, Ivo
Ivo
source share