在Android上组合位图
我想将两个位图组合在一起。但是,它无法合并 2 张超过 1600X1200 的图像。有人可以帮我解决这个问题吗?有人告诉我,它可以扩大应用程序的已用内存。 这是错误日志
> 10-26 12:07:16.492: ERROR/AndroidRuntime(3221): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.nativeCreate(Native Method)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.createBitmap(Bitmap.java:423)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.createBitmap(Bitmap.java:374)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.org.testing.TestingActivity.crop(TestingActivity.java:102)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.org.testing.TestingActivity.access$0(TestingActivity.java:97)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.org.testing.TestingActivity$2.onClick(TestingActivity.java:54)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.view.View.performClick(View.java:2428)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.view.View$PerformClick.run(View.java:8939)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.os.Handler.handleCallback(Handler.java:587)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.os.Handler.dispatchMessage(Handler.java:92)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.os.Looper.loop(Looper.java:123)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.app.ActivityThread.main(ActivityThread.java:4668)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at java.lang.reflect.Method.invoke(Method.java:521)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at dalvik.system.NativeStart.main(Native Method)
I want to combine two bitmap together. However, it can not combine 2 image that exceed 1600X1200.Can anyone help me to solve this problem? Someone tells me that it can enlarge the used memory of the apps.
Here's the error log
> 10-26 12:07:16.492: ERROR/AndroidRuntime(3221): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.nativeCreate(Native Method)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.createBitmap(Bitmap.java:423)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.graphics.Bitmap.createBitmap(Bitmap.java:374)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.org.testing.TestingActivity.crop(TestingActivity.java:102)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.org.testing.TestingActivity.access$0(TestingActivity.java:97)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.org.testing.TestingActivity$2.onClick(TestingActivity.java:54)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.view.View.performClick(View.java:2428)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.view.View$PerformClick.run(View.java:8939)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.os.Handler.handleCallback(Handler.java:587)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.os.Handler.dispatchMessage(Handler.java:92)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.os.Looper.loop(Looper.java:123)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at android.app.ActivityThread.main(ActivityThread.java:4668)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at java.lang.reflect.Method.invoke(Method.java:521)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
10-26 12:07:16.492: ERROR/AndroidRuntime(3221): at dalvik.system.NativeStart.main(Native Method)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有三个选择:
You have three options :