30 Jun 2010, 06:40
Generic-user-small

chris moore (2 posts)

I have read through some of the other issues that seem to occur in this area and have followed in comparison to the code samples provided. Issue occurs from page 66 where we are declaring About in the manifest. I added the code but I still get the same force close message on launch. Eclipse gives the following in console but not sure where else to look. No problems flagged and have tried “clean.” It has been smooth sailing up until now so just curious where I can look to knock out this issue.


[2010-06-29 23:29:34 - Sudoku] ------------------------------
[2010-06-29 23:29:34 - Sudoku] Android Launch!
[2010-06-29 23:29:34 - Sudoku] adb is running normally.
[2010-06-29 23:29:34 - Sudoku] Performing org.example.sudoku.Sudoku activity launch
[2010-06-29 23:29:34 - Sudoku] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD '2.1'
[2010-06-29 23:29:34 - Sudoku] Uploading Sudoku.apk onto device 'emulator-5554'
[2010-06-29 23:29:34 - Sudoku] Installing Sudoku.apk...
[2010-06-29 23:29:53 - Sudoku] Success!
[2010-06-29 23:29:54 - Sudoku] Starting activity org.example.sudoku.Sudoku on device 
[2010-06-29 23:30:08 - Sudoku] ActivityManager: DDM dispatch reg wait timeout
[2010-06-29 23:30:08 - Sudoku] ActivityManager: Can't dispatch DDM chunk 52454151: no handler defined
[2010-06-29 23:30:08 - Sudoku] ActivityManager: Can't dispatch DDM chunk 48454c4f: no handler defined
[2010-06-29 23:30:08 - Sudoku] ActivityManager: Can't dispatch DDM chunk 46454154: no handler defined
[2010-06-29 23:30:08 - Sudoku] ActivityManager: Can't dispatch DDM chunk 4d505251: no handler defined
[2010-06-29 23:30:14 - Sudoku] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=org.example.sudoku/.Sudoku }

30 Jun 2010, 21:06
Burnette_ed_pragsmall

Ed Burnette (1316 posts)

I looked at the zip you sent. If you run the program and open the LogCat view it shows this exception:

06-30 20:57:04.724: ERROR/AndroidRuntime(262): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.example.sudoku/org.example.sudoku.Sudoku}: java.lang.NullPointerException
06-30 20:57:04.724: ERROR/AndroidRuntime(262):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
06-30 20:57:04.724: ERROR/AndroidRuntime(262):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
...
06-30 20:57:04.724: ERROR/AndroidRuntime(262): Caused by: java.lang.NullPointerException
06-30 20:57:04.724: ERROR/AndroidRuntime(262):     at org.example.sudoku.Sudoku.onCreate(Sudoku.java:34)
06-30 20:57:04.724: ERROR/AndroidRuntime(262):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-30 20:57:04.724: ERROR/AndroidRuntime(262):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-30 20:57:04.724: ERROR/AndroidRuntime(262):     ... 11 more

The important part is “NullPointerException … at org.example.sudoku.Sudoku.onCreate(Sudoku.java:34)”. Line 34 says:

   exitButton.setOnClickListener(this);

so exitButton must be null. That means this findViewById call failed on line 33:

   View exitButton = findViewById(R.id.exit_button);

So search your XML files for the string “exit_button”. You’ll find it’s defined in res/layout-land/main.xml but not in res/layout/main.xml. Looks like you defined the about button twice by mistake in res/layout/main.xml. Your program would work in landscape mode but not in regular portrait mode.

02 Jul 2010, 04:25
Generic-user-small

chris moore (2 posts)

Ed,

Thank you so much for your assistance. Sorry I couldn’t thank you yesterday-I really do appreciate all the support you give to your readers!

16 Jul 2010, 19:13
Burnette_ed_pragsmall

Ed Burnette (1316 posts)

You’re welcome!

  You must be logged in to comment