28 Jul 2012, 05:51
Generic-user-small

Eric Sender (1 post)

First post, so want to say that this is a great book so far! But, something is fuzzy that I’d like some guidance on…

In the Sudoku example, I am trying to press the menu button while I am in the middle of a game and I notice that the settings pane doesn’t come up. The menu->settings pane comes up just fine in the opening screen, but not during the game.

So, I figured that I need to do a

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);
        return true;
    }


Call within the Game class. (Keep in mind, this code is already in the Sudoku class)

I know that is code-reuse, which I highly doubt is the right way to do things.

Also, even though this code-reuse brings up the “Settings” panel at the bottom of the screen, when I press the “settings” button I get the following error in logcat:

W/InputManagerService(   59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44f7f410

So my questions are:

- Why didn’t the onCreateOptionsMenu() call work while I was playing a game?
- How come the actual settings display didn’t show up?
- How come the logcat gave that error?
- How can I get the settings menu to work without code reuse?

I’m sure the answer to those questions are all part of the same issue, but just in case I thought I’d break it down into the individual quirks.

Appreciate any help!

25 Aug 2012, 11:51
浮雕_pragsmall

Koala Guan (1 post)

Since the menu can display in this way, the problem may be occoured because of the [onOptionsItemSelected] process.

And make sure that u’ve imported all the libraries.

I’m a green hand too and my English is rather poor…May the comment help u~

  You must be logged in to comment