I have a custom ImageView which starts a task to download an image from the web. What I exactly want for the task is to continue running while app is on current activity, even if the view is not present (for example in a scrolling gridview) which is how it is right now, but I also want to cancel the task if the user left the activity. Is there a particular method I can override for this? (something like onDestroy) or do I have to do it manually?
My custom view has a setImageUrl which starts the task for the url, other than that it's almost the same as ImageView.