Let's try this again, shall we?
On Mon, Feb 16, 2009 at 9:20 PM, Faber Fedor <[email protected]> wrote:
> 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
>
--
Faber Fedor
Linux New Jersey
http://linuxnj.com
faberfedor.blogspot.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
-~----------~----~----~----~------~----~------~--~---