-1
我已經從API緩存圖像和上課的時候我在AsyncTask
解碼位圖,還給我OutOfMemoryError
decodeStream內存溢出(LruChace)
03-28 09:15:07.455: E/AndroidRuntime(721): java.lang.RuntimeException: An error occured while executing doInBackground() 03-28 09:15:07.455: E/AndroidRuntime(721): at android.os.AsyncTask$3.done(AsyncTask.java:278) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 03-28 09:15:07.455: E/AndroidRuntime(721): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.lang.Thread.run(Thread.java:856) 03-28 09:15:07.455: E/AndroidRuntime(721): Caused by: java.lang.OutOfMemoryError 03-28 09:15:07.455: E/AndroidRuntime(721): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 03-28 09:15:07.455: E/AndroidRuntime(721): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493) 03-28 09:15:07.455: E/AndroidRuntime(721): at com.android.lifter.cache.ImageCache.loadRemoteBitmap(ImageCache.java:371) 03-28 09:15:07.455: E/AndroidRuntime(721): at com.android.lifter.cache.ImageCache.access$7(ImageCache.java:331) 03-28 09:15:07.455: E/AndroidRuntime(721): at com.android.lifter.cache.ImageCache$BitmapDownload.doInBackground(ImageCache.java:540) 03-28 09:15:07.455: E/AndroidRuntime(721): at com.android.lifter.cache.ImageCache$BitmapDownload.doInBackground(ImageCache.java:1) 03-28 09:15:07.455: E/AndroidRuntime(721): at android.os.AsyncTask$2.call(AsyncTask.java:264) 03-28 09:15:07.455: E/AndroidRuntime(721): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
代碼:http://pastebin.com/GpyLULye
檢查http://www.youtube.com/watch?v=pMRnGDR6Cu0對於您可以使用圖像緩存http://loopj.com/android-smart-image-view/ – playmaker420