我的安卓程序突然運行終止,logCat錯誤信息如下:
05-26 10:49:54.540: E/AndroidRuntime(30584): java.lang.OutOfMemoryError
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:527)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:301)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:326)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.app.Activity.dispatchActivityResult(Activity.java:5274)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.app.ActivityThread.deliverResults(ActivityThread.java:3158)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3205)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.app.ActivityThread.access$1100(ActivityThread.java:136)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1249)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.os.Handler.dispatchMessage(Handler.java:99)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.os.Looper.loop(Looper.java:137)
05-26 10:49:54.540: E/AndroidRuntime(30584): at android.app.ActivityThread.main(ActivityThread.java:4881)
05-26 10:49:54.540: E/AndroidRuntime(30584): at java.lang.reflect.Method.invokeNative(Native Method)
05-26 10:49:54.540: E/AndroidRuntime(30584): at java.lang.reflect.Method.invoke(Method.java:511)
05-26 10:49:54.540: E/AndroidRuntime(30584): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:804)
05-26 10:49:54.540: E/AndroidRuntime(30584): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:571)
05-26 10:49:54.540: E/AndroidRuntime(30584): at dalvik.system.NativeStart.main(Native Method)
這個最錯誤的原因是什麼?怎麼可以解決?求大神。
這個問題已經解決了,在每張圖片處理完後,對bitmap進行回收就OK了。