我正在使用 Base64 从相机拍照以及从 SD 卡中挑选图像,同时在 imageview 中保存图像时出现 OutOfMemoryError。下面是错误日志。请帮忙。
错误日志
11-20 15:58:50.098: E/AndroidRuntime(4790): FATAL EXCEPTION: main
11-20 15:58:50.098: E/AndroidRuntime(4790): java.lang.OutOfMemoryError
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:306)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:331)
11-20 15:58:50.098: E/AndroidRuntime(4790): at com.Infoicon.KidsBSafeNew.MainActivity.onActivityResult(MainActivity.java:606)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.app.Activity.dispatchActivityResult(Activity.java:4649)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.app.ActivityThread.deliverResults(ActivityThread.java:2996)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3043)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.app.ActivityThread.access$1100(ActivityThread.java:127)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1188)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.os.Looper.loop(Looper.java:137)
11-20 15:58:50.098: E/AndroidRuntime(4790): at android.app.ActivityThread.main(ActivityThread.java:4441)
11-20 15:58:50.098: E/AndroidRuntime(4790): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 15:58:50.098: E/AndroidRuntime(4790): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 15:58:50.098: E/AndroidRuntime(4790): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-20 15:58:50.098: E/AndroidRuntime(4790): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-20 15:58:50.098: E/AndroidRuntime(4790): at dalvik.system.NativeStart.main(Native Method)
11-20 15:58:50.118: E/System(4790): java.lang.IllegalStateException: Don't have database lock!
11-20 15:58:50.118: E/System(4790): at android.database.sqlite.SQLiteDatabase.verifyLockOwner(SQLiteDatabase.java:2090)
11-20 15:58:50.118: E/System(4790): at android.database.sqlite.SQLiteDatabase$1.entryRemoved(SQLiteDatabase.java:2182)
11-20 15:58:50.118: E/System(4790): at android.database.sqlite.SQLiteDatabase$1.entryRemoved(SQLiteDatabase.java:2178)
11-20 15:58:50.118: E/System(4790): at android.util.LruCache.trimToSize(LruCache.java:197)
11-20 15:58:50.118: E/System(4790): at android.util.LruCache.evictAll(LruCache.java:285)
11-20 15:58:50.118: E/System(4790): at android.database.sqlite.SQLiteDatabase.deallocCachedSqlStatements(SQLiteDatabase.java:2143)
11-20 15:58:50.118: E/System(4790): at android.database.sqlite.SQLiteDatabase.closeClosable(SQLiteDatabase.java:1126)
11-20 15:58:50.118: E/System(4790): at android.database.sqlite.SQLiteDatabase.finalize(SQLiteDatabase.java:1914)
11-20 15:58:50.118: E/System(4790): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182)
11-20 15:58:50.118: E/System(4790): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
11-20 15:58:50.118: E/System(4790): at java.lang.Thread.run(Thread.java:856)