public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
menu.add(0, 1, 1, "退出").setIcon(R.drawable.ic_launcher);;
menu.add(0, 2, 2, "关于").setIcon(R.drawable.ic_launcher);;
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
if(item.getItemId() == 1){
//SysApplication.getInstance().exit();
new AlertDialog.Builder(this).setMessage("您确定要退出").
setPositiveButton("确定",new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialogInterface ,int i){
finish();
}
}
).setNegativeButton("取消",new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialogInterface ,int i){
} }).show();
}
else if(item.getItemId() == 2){
Toast.makeText(this, "关于藁城之窗",Toast.LENGTH_SHORT).show();
}
return true;
}