It seems to be impossible to show checkmarks in the optionsmenu. If that is the case, then I have to change the menu item text dynamically to reflect the current state, right? Comments, please!
On 2 Apr, 07:00, zhoubo shi <zhoubo....@gmail.com> wrote: > please, say error message! > > 2009/4/2 Glen Humphrey <glendon.humphr...@gmail.com> > > > > > > > What does it say is wrong? > > > On Apr 1, 12:07 am, Allan Ai <aichang...@gmail.com> wrote: > > > Why I cann`t run the following case? It says there are sth. wrong at > > > "onCreateOptionsMenu","onOptionsItemSelected"&"onPrepareOptionsMenu" . > > > > package com.demo.menu; > > > > import android.app.Activity; > > > import android.os.Bundle; > > > > public class MenuDemo extends Activity { > > > /** Called when the activity is first created. */ > > > @Override > > > public void onCreate(Bundle savedInstanceState) { > > > super.onCreate(savedInstanceState); > > > setContentView(R.layout.main); > > > } > > > > @Override > > > public boolean onCreateOptionsMenu(Menu menu) { > > > super.onCreateOptionsMenu(menu); > > > menu.add(0,0,0,"1"); > > > menu.add(0,1,0,"2"); > > > menu.add(0,2,0,"3"); > > > menu.add(0,3,0,"4"); > > > menu.add(0,4,0,"5"); > > > return true; > > > } > > > > �...@override > > > public boolean onOptionsItemSelected(MenuItem item) { > > > super.onOptionsItemSelected(item); > > > TextView view = (TextView) findViewById(R.id.text_view); > > > switch (item.getItemId()) { > > > case 0: > > > view.setText("This is"+item.getTitle()); > > > break; > > > case 1: > > > view.setText("This is"+item.getTitle()); > > > break; > > > default: > > > view.setText("Debug."); > > > break; > > > } > > > return false; > > > } > > > > �...@override > > > public boolean onPrepareOptionsMenu(Menu menu) { > > > return super.onPrepareOptionsMenu(menu); > > > } > > > > }- Dölj citerad text - > > - Visa citerad text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---