package com.OptionsMenu;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class OptionsMenu 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) {
// TODO Auto-generated method stub
menu.add(0, 0, 0, "Option 0");
menu.add(0, 1, 1, "Option 1");
menu.add(0, 2, 2, "Option 2");
menu.add(0, 3, 3, "Option 3");
menu.add(0, 4, 4, "Option 4");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch(item.getItemId()){
case (0):
break;
case (1):
break;
case (2):
break;
case (3):
break;
case (4):
break;
}
return true;
}
}
Langganan:
Posting Komentar (Atom)
0 Response to "Create OptionsMenu using menu.add()"
Posting Komentar