Android Sudoku app hangs up the issue

Source: Internet
Author: User

When I test Sudoku on a real machine, I find that when I click the screen quickly, the game occasionally hangs dead, log as follows

04-08 15:35:00.838 7317-7356/org.elvalad.sudoku d/openglrenderer:enabling debug mode 004-08 15:35:23.036 7317-7317/ Org.elvalad.sudoku e/inputeventreceiver:exception dispatching input event.04-08 15:35:23.036 7317-7317/ Org.elvalad.sudoku e/messagequeue-jni:exception in MessageQueue callback:handlereceivecallback04-08 15:35:23.041 731 7-7317/org.elvalad.sudoku e/messagequeue-jni:java.lang.arrayindexoutofboundsexception:length=81; index=83 at Org.elvalad.sudoku.GameView.onTouchEvent (gameview.java:282) at ANDROID.VIEW.VIEW.DISPATC            Htouchevent (view.java:8393) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2432) At Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2119) at Android.view.ViewGroup.dispatchTransf            Ormedtouchevent (viewgroup.java:2432) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2119) At Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2432) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2119) at ANDROID.VIEW.V Iewgroup.dispatchtransformedtouchevent (viewgroup.java:2432) at Android.view.ViewGroup.dispatchTouchEvent (VIEWGR oup.java:2119) at Com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent (PhoneWindow.ja            va:2314) at Com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (phonewindow.java:1692) At Android.app.Activity.dispatchTouchEvent (activity.java:2749) at Com.android.internal.policy.impl.PhoneWin Dow$decorview.dispatchtouchevent (phonewindow.java:2275) at Android.view.View.dispatchPointerEvent (view.java:858  3) at Android.view.viewrootimpl$viewpostimeinputstage.processpointerevent (viewrootimpl.java:4091) at Android.view.viewrootimpl$viewpostimeinputstage.onprocess (viewrootimpl.java:3957) at Android.view.ViewRootImpl $InputStage. Deliver (Viewrootimpl.java:3509) at Android.view.viewrootimpl$inputstage.ondelivertonext (viewrootimpl.java:3562) At Android.view.viewrootimpl$inputstage.forward (viewrootimpl.java:3528) at Android.view.viewrootimpl$asyncinput            Stage.forward (viewrootimpl.java:3638) at android.view.viewrootimpl$inputstage.apply (ViewRootImpl.java:3536) At Android.view.viewrootimpl$asyncinputstage.apply (viewrootimpl.java:3695) at Android.view.ViewRootImpl $InputStage. Deliver (viewrootimpl.java:3509) at Android.view.viewrootimpl$inputstage.ondelivertonext (ViewRootImp l.java:3562) at Android.view.viewrootimpl$inputstage.forward (viewrootimpl.java:3528) at Android.view . Viewrootimpl$inputstage.apply (viewrootimpl.java:3536) at Android.view.viewrootimpl$inputstage.deliver (ViewRootI mpl.java:3509) at Android.view.ViewRootImpl.deliverInputEvent (viewrootimpl.java:5806) at Android.vie W.viewrootimpl.doprocesSinputevents (viewrootimpl.java:5745) at Android.view.ViewRootImpl.enqueueInputEvent (viewrootimpl.java:5716) At Android.view.viewrootimpl$windowinputeventreceiver.oninputevent (viewrootimpl.java:5896) at ANDROID.V Iew. Inputeventreceiver.dispatchinputevent (inputeventreceiver.java:192) at Android.os.MessageQueue.nativePollOnce (Na tive Method) at Android.os.MessageQueue.next (messagequeue.java:143) at Android.os.Looper.loop (Looper . java:122) at Android.app.ActivityThread.main (activitythread.java:5312) at Java.lang.reflect.Method. Invoke (Native Method) at Java.lang.reflect.Method.invoke (method.java:372) at Com.android.internal.os . Zygoteinit$methodandargscaller.run (zygoteinit.java:901) at Com.android.internal.os.ZygoteInit.main (ZYGOTEINIT.J ava:696) 04-08 15:35:23.041 7317-7317/org.elvalad.sudoku d/androidruntime:shutting down VM04-08 15:35:23.042 7317-73 17/org.elvalad.sudoKu e/androidruntime:fatal exception:main Process:org.elvalad.sudoku, pid:7317 java.lang.ArrayIndexOutOfBoundsExc eption:length=81; index=83 at Org.elvalad.sudoku.GameView.onTouchEvent (gameview.java:282) at ANDROID.VIEW.VIEW.DISPATC            Htouchevent (view.java:8393) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2432) At Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2119) at Android.view.ViewGroup.dispatchTransf            Ormedtouchevent (viewgroup.java:2432) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2119) At Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2432) at Android.view.ViewGroup.dispa             Tchtouchevent (viewgroup.java:2119) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2432) At Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2119) at com.android.internal.policy.im Pl. PhOnewindow$decorview.superdispatchtouchevent (phonewindow.java:2314) at Com.android.internal.policy.impl.PhoneWin Dow.superdispatchtouchevent (phonewindow.java:1692) at Android.app.Activity.dispatchTouchEvent (activity.java:274            9) at Com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent (phonewindow.java:2275) At Android.view.View.dispatchPointerEvent (view.java:8583) at Android.view.viewrootimpl$viewpostimeinputstage . Processpointerevent (viewrootimpl.java:4091) at Android.view.viewrootimpl$viewpostimeinputstage.onprocess (ViewR ootimpl.java:3957) at Android.view.viewrootimpl$inputstage.deliver (viewrootimpl.java:3509) at Androi D.view.viewrootimpl$inputstage.ondelivertonext (viewrootimpl.java:3562) at Android.view.viewrootimpl$inputstage.            Forward (viewrootimpl.java:3528) at Android.view.viewrootimpl$asyncinputstage.forward (viewrootimpl.java:3638) At Android.view. Viewrootimpl$inputstage.apply (viewrootimpl.java:3536) at android.view.viewrootimpl$asyncinputstage.apply (ViewRo otimpl.java:3695) at Android.view.viewrootimpl$inputstage.deliver (viewrootimpl.java:3509) at Android . View. Viewrootimpl$inputstage.ondelivertonext (viewrootimpl.java:3562) at Android.view.viewrootimpl$inputstage.forward (viewrootimpl.java:3528) at android.view.viewrootimpl$inputstage.apply (viewrootimpl.java:3536) at a Droid.view.viewrootimpl$inputstage.deliver (viewrootimpl.java:3509) at Android.view.ViewRootImpl.deliverInputEve            NT (viewrootimpl.java:5806) at android.view.ViewRootImpl.doProcessInputEvents (viewrootimpl.java:5745) At Android.view.ViewRootImpl.enqueueInputEvent (viewrootimpl.java:5716) at Android.view.viewrootimpl$windowinpu Teventreceiver.oninputevent (viewrootimpl.java:5896) at Android.view.InputEventReceiver.dispatchInputEvent (Input Eventreceiver.java:192) at Android.os.MessageQueue.nativePollOnce (Native Method) at Android.os.MessageQueue.next (Mess agequeue.java:143) at Android.os.Looper.loop (looper.java:122) at Android.app.ActivityThread.main (Act ivitythread.java:5312) at Java.lang.reflect.Method.invoke (Native Method) at Java.lang.reflect.Method            . Invoke (method.java:372) at Com.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:901) At Com.android.internal.os.ZygoteInit.main (zygoteinit.java:696)

It is easy to find out from log that the array is out of bounds, that we are not exactly right when we draw the game grid, a simple way to do this is when we use the array to add a protection mechanism, when the index of the array is greater than 81 o'clock to make this touch screen action invalid.

Android Sudoku app hangs up the issue

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.