Duplicate menu

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Duplicate menu

Postby liaowg » Wed Jun 04, 2008 3:58 am

When working with a MapActivity, each time you press menu button, the menu items is duplicate.

I donot find other Activities have such a feature, here is my fix

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2.         public boolean onPrepareOptionsMenu(Menu menu) {
  3.                 // TODO Auto-generated method stub
  4.                 super.onPrepareOptionsMenu(menu);
  5.                 <span style="color: red">if(menu.size()>0) return true;</span>
  6.                 menu.add(0, ID_NAVIGATE, R.string.navigate, R.drawable.icon).setShortcut('0', 'n');
  7.                 menu.add(0, ID_SATELITE, R.string.satelite, R.drawable.icon).setShortcut('1', 's');
  8.                 menu.add(0, ID_TRAFFIC, R.string.traffic, R.drawable.icon).setShortcut('2', 't');
  9.                 menu.add(0, ID_JINGHU, R.string.jinghu, R.drawable.icon).setShortcut('3', 'j');
  10.                 return true;
  11.         }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
liaowg
Junior Developer
Junior Developer
 
Posts: 12
Joined: Tue Jun 03, 2008 7:26 am

Top

Return to Map Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests