0
我很絕望,我不知道該怎麼辦。我已經嘗試了很多事情來解決這個問題,並且我總是離開OutOfMemory錯誤。我有一個通用圖像裝載機圖書館和許多其他互聯網修復嘗試,但我總是得到這個錯誤:GridView 50上的Android java.lang.OutOfMemoryError Drawables圖像
03-13 12:45:05.151: E/AndroidRuntime(6460): FATAL EXCEPTION: main
03-13 12:45:05.151: E/AndroidRuntime(6460): java.lang.OutOfMemoryError
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:577)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:775)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.content.res.Resources.loadDrawable(Resources.java:1998)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.content.res.Resources.getDrawable(Resources.java:707)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.ImageView.resolveUri(ImageView.java:542)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.ImageView.setImageResource(ImageView.java:315)
03-13 12:45:05.151: E/AndroidRuntime(6460): at com.example.nititzart.jigsawpuzzle.ImageAdapter.getView(ImageAdapter.java:65)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.AbsListView.obtainView(AbsListView.java:2431)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.GridView.makeAndAddView(GridView.java:1323)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.GridView.makeRow(GridView.java:328)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.GridView.fillDown(GridView.java:281)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.GridView.fillGap(GridView.java:241)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5737)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4878)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.os.Handler.handleCallback(Handler.java:605)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.os.Handler.dispatchMessage(Handler.java:92)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.os.Looper.loop(Looper.java:137)
03-13 12:45:05.151: E/AndroidRuntime(6460): at android.app.ActivityThread.main(ActivityThread.java:4517)
03-13 12:45:05.151: E/AndroidRuntime(6460): at java.lang.reflect.Method.invokeNative(Native Method)
03-13 12:45:05.151: E/AndroidRuntime(6460): at java.lang.reflect.Method.invoke(Method.java:511)
03-13 12:45:05.151: E/AndroidRuntime(6460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
03-13 12:45:05.151: E/AndroidRuntime(6460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
03-13 12:45:05.151: E/AndroidRuntime(6460): at dalvik.system.NativeStart.main(Native Method)
我的應用程序總共有50個圖像的在GridView。每個圖像都是一個每個25KB的JPG文件。我真的需要幫助,因爲現在我完全不知道該怎麼做。
分享你已經嘗試在電網創造與負載的圖像。 –
你有'outOfMemory'錯誤。在這種情況下,我認爲你需要檢查你是否在運行時存儲圖像並使用它們顯示。可能是你需要壓縮它們。 – DroidDev