Hi there,

I find the Notepad tutorial to be anything but simple for me.  Could
someone tell me in the code below why you call super immediately in
method 1 and then last in method 2?  I had thought that if you're
going to call super,you had to do it immediately (or is that only with
a constructor but not with a method)?

Also, if you return true in method 2, does that mean that super is
never called b/c you exit the switch statement immediately?  If you do
exit, then you're not chaining up to the superclass' method, which I
thought you always want to do.  I'm not even sure what the superclass'
onOptionsItemSelected() does anyway.  Does everyone understand every
line of code or should I just stop trying to analyze what every
parameter means and just sort of follow a formula?  I guess that I am
finding Android extremely hard to understand from the documentation.


METHOD 1
@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean result = super.onCreateOptionsMenu(menu);
        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
        return result;
    }

METHOD 2
 @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case INSERT_ID:
            createNote();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

Thanks!

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

Reply via email to