small medium large xlarge

Generic-user-small
18 Apr 2011, 11:10
Zhi H Li (1 post)

Hello,

I’m getting the following error after I click/touch the screen of the “Sudoku Program”. I get past the difficulty setting and then the game freezes and if I click/touch it I get a “force close” and the following is on my Log Cat:

Note: I’m a running sdk ver. 8, I’m not sure if this is the problem however….

04-18 11:03:21.513: WARN/dalvikvm(280): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): FATAL EXCEPTION: main 04-18 11:03:21.593: ERROR/AndroidRuntime(280): java.lang.NullPointerException 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at org.example.sudoku.Keypad.onCreate(Keypad.java:34) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.app.Dialog.dispatchOnCreate(Dialog.java:307) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.app.Dialog.show(Dialog.java:225) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at org.example.sudoku.Game.showKeypadOrError(Game.java:46) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at org.example.sudoku.PuzzleView.onTouchEvent(PuzzleView.java:47) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.View.dispatchTouchEvent(View.java:3766) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.app.Activity.dispatchTouchEvent(Activity.java:2086) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655) 04-18 11:03:21.513: WARN/dalvikvm(280): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): FATAL EXCEPTION: main 04-18 11:03:21.593: ERROR/AndroidRuntime(280): java.lang.NullPointerException 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at org.example.sudoku.Keypad.onCreate(Keypad.java:34) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.app.Dialog.dispatchOnCreate(Dialog.java:307) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.app.Dialog.show(Dialog.java:225) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at org.example.sudoku.Game.showKeypadOrError(Game.java:46) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at org.example.sudoku.PuzzleView.onTouchEvent(PuzzleView.java:47) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.View.dispatchTouchEvent(View.java:3766) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at android.app.Activity.dispatchTouchEvent(Activity.java:2086) 04-18 11:03:21.593: ERROR/AndroidRuntime(280): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)

Thanks,

Zhi

Generic-user-small
18 Apr 2011, 11:43
Anthony Shaw (138 posts)

The problem seems to be in the onCreate() method of Keypad.java. The line that is causing the problem is line 34. The LogCat does not show us what line 34 actually is, so if you could post your Keypad.java we should be able to tell what the problem is. At a guess I would say it is a problem in the setContentView call, maybe because there is something wrong with the keypad layout in keypad.xml

Burnette_ed_pragsmall
21 Apr 2011, 17:29
Ed Burnette (1330 posts)

The most common cause is that you called findViewById() and it returned null because the id you passed couldn’t be found in the current view.

  You must be logged in to comment