I have an application made which draws a square on the screen. The user can move the square around, increase its width and height using his/her finger (touch events) etc etc. The user is also able to add any number of squares and move them separately.
The app works fine for most of the part but sometimes it crashes and gives this below error
05-09 11:32:49.488: E/AndroidRuntime(24826): FATAL EXCEPTION: main
05-09 11:32:49.488: E/AndroidRuntime(24826): Process: com.example, PID: 24826
05-09 11:32:49.488: E/AndroidRuntime(24826): java.lang.OutOfMemoryError
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.nativeCreate(Native Method)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.createBitmap(Bitmap.java:835)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.createBitmap(Bitmap.java:812)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.createBitmap(Bitmap.java:779)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.example.Square.isClicked(Square.java:478)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.example.EditBubbleView$2.onTouch(EditBubbleView.java:378)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.View.dispatchTouchEvent(View.java:7731)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2238)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.app.Activity.dispatchTouchEvent(Activity.java:2466)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2016)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.View.dispatchPointerEvent(View.java:7916)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4031)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3910)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3460)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3510)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3479)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3586)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3487)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3643)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3460)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3510)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3479)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3487)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3460)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5728)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5659)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5630)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5808)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.os.MessageQueue.nativePollOnce(Native Method)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.os.MessageQueue.next(MessageQueue.java:138)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.os.Looper.loop(Looper.java:123)
05-09 11:32:49.488: E/AndroidRuntime(24826): at android.app.ActivityThread.main(ActivityThread.java:5102)
05-09 11:32:49.488: E/AndroidRuntime(24826): at java.lang.reflect.Method.invokeNative(Native Method)
05-09 11:32:49.488: E/AndroidRuntime(24826): at java.lang.reflect.Method.invoke(Method.java:515)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
05-09 11:32:49.488: E/AndroidRuntime(24826): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
05-09 11:32:49.488: E/AndroidRuntime(24826): at dalvik.system.NativeStart.main(Native Method)
Can any one tell me how to resolve this. Thanks :)
SquareandEditBubbleView