0

I want to decode bitmap stream from network then put in listview items. I use multithread for this issue. When user scroll on listview, the threads is running preloadtasks not necessary will be canceld(decodeBitmap) to give priority for tasks which show current images.

The problem here is thread cannot be interrupted while decodeBitmap, and still useless task until it's done.

How to resolve for this issue? Thanks for all the help.

hecarim
  • 87
  • 1
  • 5
  • Maybe have another worker-thread calling decodeBitmap so you can move the more relevant task to it and ignore results from the previous thread? – PazO Dec 19 '15 at 09:57
  • Did you try using runOnUiThread method? [Here's](http://stackoverflow.com/questions/11140285/how-to-use-runonuithread) a good example. – Muhammad A. Hassan Dec 19 '15 at 09:59
  • Thank you guys, I have found a solution to this problem. I work around for this problem, divided into two steps: 1. Download file to sdcard, and in this step, i can interrupt thread very easy, i check interrupt for each percent file download. 2.After the file was saved in sdcard, then i decode it. – hecarim Jan 01 '16 at 09:52

0 Answers0