0
我收到一個崩潰報告,說我在調用startManagingCursor時OutOfMemoryError。這裏是返回的堆棧跟蹤:Android OutOfMemoryError startManagingCursor中的崩潰
java.lang.OutOfMemoryError
at java.util.ArrayList.add(ArrayList.java:123)
at android.app.Activity.startManagingCursor(Activity.java:1652)
at com.bubblewaretechnology.pianounlockscreen.LockDetecter.onResume(LockDetecter.java:633)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
at android.app.ActivityThread.performNewIntents(ActivityThread.java:1789)
at android.app.ActivityThread.handleNewIntent(ActivityThread.java:1795)
at android.app.ActivityThread.access$2300(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1015)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
我非常小心地關閉我的遊標,SQLiteDatabase和SQLiteOpenHelper。這是一個短代碼段,崩潰是指:
Cursor callCursor = lockLib.getCallState();
startManagingCursor(callCursor);
....
callCursor.close();
對如何去解決這個問題很難。我知道startManagingCursor是貶值的,但我不是針對HONEYCOMB或更高版本,所以我不能切換到CursorLoader。有沒有人有任何建議如何進行?