多线程环境下 java.io.IOException: Mark has been invalidated.

bitmap = BitmapFactory.decodeStream(uc.getInputStream()); 
12-15 15:25:47.275: W/System.err(2303): java.io.IOException: Mark has been invalidated.
12-15 15:25:47.295: W/System.err(2303): 	at java.io.BufferedInputStream.reset(BufferedInputStream.java:425)
12-15 15:25:47.335: W/System.err(2303): 	at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
12-15 15:25:47.345: W/System.err(2303): 	at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:505)
12-15 15:25:47.365: W/System.err(2303): 	at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:566)
12-15 15:25:47.385: W/System.err(2303): 	at org.droid.util.view.BitmapUtils.loadBitmapFromNet(BitmapUtils.java:50)
12-15 15:25:47.395: W/System.err(2303): 	at org.droid.util.AsyncLoader.doInBackground(AsyncLoader.java:39)
12-15 15:25:47.405: W/System.err(2303): 	at android.os.AsyncTask$2.call(AsyncTask.java:216)
12-15 15:25:47.425: W/System.err(2303): 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:336)
12-15 15:25:47.435: W/System.err(2303): 	at java.util.concurrent.FutureTask.run(FutureTask.java:168)
12-15 15:25:47.445: W/System.err(2303): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1099)
12-15 15:25:47.465: W/System.err(2303): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:592)
12-15 15:25:47.485: W/System.err(2303): 	at java.lang.Thread.run(Thread.java:1127)


究其原因 主要是 多个线程操作了 HttpUrlConnection 这个对象。。

解决办法 。 把 static方法改成非static的了。然后每次都重新撞见一个对象 问题解决

你可能感兴趣的:(多线程)