background image

public class HelloActivity extends Activity { 

 

 @Override

 public boolean onCreateOptionsMenu(Menu menu) {

  // TODO Auto-generated method stub

  super.onCreateOptionsMenu(menu);

  menu.add(0, Menu.FIRST+1, 1, R.string.menu_open);

  menu.add(0, Menu.FIRST+2, 2, R.string.menu_edit);

  menu.add(0, Menu.FIRST+3, 3, R.string.menu_update);

  menu.add(0, Menu.FIRST+4, 4, R.string.menu_close);

  return true;

 }

 @Override

 public boolean onOptionsItemSelected(MenuItem item) {

  // TODO Auto-generated method stub

  super.onOptionsItemSelected(item);

  switch(item.getItemId())

  {

  case Menu.FIRST + 1:

  {

   this.setTitle("Open Text!");

   Intent i = new Intent();   

   i.setAction("test_action");  

   if (Tools.isIntentAvailable(this,i))

    this.startActivity(i);

   else

    this.setTitle("the Intent is unavailable!!!");

   break;

                     找软件资料,就到一览软件文库

http://wk.yl1001.com/rj/

3