I was working through the Notepad tutorial...
http://developer.android.com/guide/tutorials/notepad/index.html

...and I seem to either have a misunderstanding of what is supposed to
be happening, or the code is not working.


Below are two snippets of code from the tutorial to illustrate my
questions/concerns:

It looks like this is the "menu" that is brought up when you have no
items selected and you press the Menu key...
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
        return true;
    }

...this is the behavior that I expected and saw.

However, when I have one of the notes selected, I would expect this
code snippet to run...
        @Override
        public boolean onContextItemSelected(MenuItem item) {
                switch(item.getItemId()) {
        case DELETE_ID:
                AdapterContextMenuInfo info = (AdapterContextMenuInfo)
item.getMenuInfo();
                mDbHelper.deleteNote(info.id);
                fillData();
                return true;
                }
                return super.onContextItemSelected(item);
        }

...but it doesn't :(

Can anyone help me out here?

I can never get the "delete" option to show up in the tutorial.

Thanks for  your help!
-Matt

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to