I got always the same problem :( I'll try to join my code. It's rises the exception when I click on the button.
On Thu, Feb 25, 2010 at 11:26 AM, skink <[email protected]> wrote: > try this, tested on android 1.5 > > public class MenuTest extends Activity implements OnClickListener { > @Override > protected void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > Button b = new Button(this); > b.setText("open menu"); > b.setOnClickListener(this); > setContentView(b); > } > > public void onClick(View v) { > openOptionsMenu(); > } > > @Override > public boolean onCreateOptionsMenu(Menu menu) { > menu.add("option 1"); > menu.add("option 2"); > menu.add("option 3"); > return super.onCreateOptionsMenu(menu); > } > > @Override > public boolean onOptionsItemSelected(MenuItem item) { > System.out.println(item); > return super.onOptionsItemSelected(item); > } > } > > > pskink > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 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
showMenuTest.tar.gz
Description: GNU Zip compressed data

