package com.example.uitest2;
import android.R.menu;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
private static final int ITEM1=Menu.FIRST;
private static final int ITEM2=Menu.FIRST+1;
private static final int ITEM3=Menu.FIRST+2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.main, menu);
menu.add(0, ITEM1 ,0,”START”);
menu.add(0, ITEM2 ,0,”OUT”);
menu.add(0, ITEM3 ,0,”CHECK”);
return true;
}
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId()) {
case ITEM1:
setTitle(“start Game”);
break;
case ITEM2:
setTitle(“out game”);
break;
case ITEM3:
setTitle(“CHECK game”);
break;
}
return true;
}
}