On my map menu I've got two menuitems: "Map View" and "Satellite View".  I'm
sure you can figure out what they do. :-)  I want to push "Map View" and
have the "Satellite View" menuitem disappear and vice-versa.  I thought the
following code was the obvious way to do it, but my map_menuitem and
satellite_menuitem are both set to null.  Yes, the R.id's do exist and
Eclipse is happy with all the code. I don't see why this shouldn't work,
'cept it don't. Suggestions?

<CODE>
    public boolean onOptionsItemSelected(MenuItem item) {

        Intent i;

        switch(item.getItemId()) {
            case R.id.satellite_menuitem:
                MenuItem map_menuitem  = (MenuItem)
findViewById(R.id.map_menuitem);
                map_menuitem.setVisible(false);

                item.setVisible(true);

                map.setSatellite(true);
                map.invalidate();
                break;
            case R.id.map_menuitem:
                MenuItem satellite_menuitem  = (MenuItem)
findViewById(R.id.satellite_menuitem);
                satellite_menuitem.setVisible(false);

                item.setVisible(true);

                map.setSatellite(false);
                map.invalidate();
                break;
        }

        return(super.onOptionsItemSelected(item));
    }

</CODE>


-- 
Faber Fedor
Linux New Jersey
http://linuxnj.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to