Bitmap size exceeds VM budget
I am passing my image into xml,by resize my image size using:
scaled = Bitmap.createScaledBitmap(bp, h, w, true);
imgV.setImageBitmap(scaled);
but am getting bitmap size exceeds Vm budget.
04-30 18:36:16.552: ERROR/AndroidRuntime(7164): FATAL EXCEPTION: main 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:525) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at com.webrich.bachflower.TopicController.getImageBitmap(TopicController.java:103) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at com.webrich.bachflower.TopicController.onCreate(TopicController.java:73) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.app.ActivityThread.performLaun chActivity(ActivityThread.java:1611) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.os.Handler.dispatchMessage(Handler.java:99) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.os.Looper.loop(Looper.java:123) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at android.app.ActivityThread.main(ActivityThread.java:3683) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at java.lang.reflect.Method.invokeNative(Native Method) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at java.lang.reflect.Method.invoke(Method.java:507) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at com.android.internal.os.ZygoteInit$MethodAndAr gsCaller.run(ZygoteInit.java:839) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-30 18:36:16.552: ERROR/AndroidRuntime(7164): at dalvik.system.NativeStart.main(Native Method) 04-30 18:36:16.602: WARN/ActivityManager(63): Force finishing activity com.webrich.bachflower/.TopicController 04-30 18:36:17.132: WARN/ActivityManager(63): Activity pause timeout for HistoryRecord{407ff648 com.webrich.bachflower/.TopicController} 04-30 18:36:19.762: DEBUG/SntpClient(63): request time failed: java.net.SocketException: Address family not supported by protocol 04-30 18:36:20.212: INFO/Process(7164): Sending signal. PID: 7164 SIG: 9 04-30 18:36:20.302: INFO/ActivityManager(63): Process com.webrich.bachflower (pid 7164) has died. 04-30 18:36:20.302: INFO/WindowManager(63): WIN DEATH: Window{407e6b88 com.webrich.bachflower/com.webrich.bachflower.FlowerController paused=false} 04-30 18:36:20.362: ERROR/InputDispatcher(63): channel '407fcdb8 com.webrich.bachflower/com.webrich.bachflower.Topics (server)' ~ Consumer closed input channel or an error occurred. events=0x8 04-30 18:36:20.362: ERROR/InputDispatcher(63): channel '407fcdb8 com.webrich.bachflower/com.webrich.bachflower.Topics (server)' ~ Channel is unrecoverably broken and will be disposed! 04-30 18:36:20.412: INFO/WindowManager(63): WIN DEATH: Window{407fcdb8 com.webrich.bachflower/com.webrich.bachflower.Topics paused=false} 04-30 18:36:20.882: WARN/InputManagerService(63): Got RemoteException sending setActive(false) notification to pid 7164 uid 10034
Is this not a duplicate of this question: Strange out of memory issue while loading an image to a Bitmap object
In particular, the answer you are looking for is (#comment link): Strange out of memory issue while loading an image to a Bitmap object
链接地址: http://www.djcxy.com/p/33652.html上一篇: admob adview在旋转时会导致Android崩溃
下一篇: 位图大小超过虚拟机预算