You can make it even more robust (for future expansion), if you
override the Thread's method 'interrupt()' in your DownloadThread
class.
@Override
public void interrupt() throws SecurityException {
disconnect();
super.interrupt();
}
This is just in case your download thread is not reading at the moment
from a socket but in a wait-state. And instead of calling
'downloadThread.disconnect();', you can call 'downloadThread.interrupt
();'
On Jun 10, 2:00 pm, guojian <[email protected]> wrote:
> You're right. I added a simple cancel() method for now which closes
> the HttpUrlConnection. I decided to keep it simple for the moment but
> it would be nice for the ImageLoader class to dispatch progress and
> complete events.
>
> On Jun 9, 4:05 pm, Streets Of Boston <[email protected]> wrote:
>
>
>
> > Thanks!
>
> > But looking at your code, you can't stop an already ongoing download
> > (i.e. cancel a download that takes too long).
>
> > I've written a similar helper class does the same, like AsyncTask, but
> > allows you to cancel or interrupt I/O operations immediately, e.g.
> > cancel the download of an image that takes too long.
>
> > I have not yet put this class online, but i will soon.
>
> > On Jun 9, 10:00 am, guojian <[email protected]> wrote:
>
> > > To make loading images from the web less of a pain, I created a little
> > > helper class
>
> > > To load an image you simply call
> > > ImageLoader.getInstance().load(myImageView, "myimage.jpg", true);
>
> > >http://wu-media.com/2009/06/android-imageloader-load-images-sequencia...
>
> > > 1. It loads images sequentially
> > > 2. It has the ability to cache the loaded images
> > > 3. you can stop the downloads by calling clearQueue()
> > > 4. you can clear the cache by calling clearCache()
>
> > > I hope somebody finds this useful, or if you have any suggestion on
> > > how i can make it better, leave me a comment :)- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---