private void loadMenuItems() { ArrayList<CustomMenuItem> menuItems = new ArrayList<CustomMenuItem>(); CustomMenuItem cmi = new CustomMenuItem(); cmi.setCaption("Settings"); cmi.setImageResourceId(R.drawable.userpicsmall); cmi.setId(MENU_ITEM_1); menuItems.add(cmi); cmi = new CustomMenuItem(); cmi.setCaption("Log Out"); cmi.setImageResourceId(R.drawable.userpicsmall); cmi.setId(MENU_ITEM_2); menuItems.add(cmi); /* * cmi = new CustomMenuItem(); cmi.setCaption("Report an Incident"); * cmi.setImageResourceId(R.drawable.sk_bbar_complaint_ico_d); * cmi.setId(MENU_ITEM_3); menuItems.add(cmi); cmi = new * CustomMenuItem(); cmi.setCaption("View Councils"); * cmi.setImageResourceId(R.drawable.sk_bbar_council_ico_d); * cmi.setId(MENU_ITEM_4); menuItems.add(cmi); cmi = new * CustomMenuItem(); cmi.setCaption("Settings"); * cmi.setImageResourceId(R.drawable.sk_bbar_settings_ico_d); * cmi.setId(MENU_ITEM_5); menuItems.add(cmi); */ if (!mMenu.isShowing()) try { mMenu.setMenuItems(menuItems); } catch (Exception e) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Egads!"); alert.setMessage(e.getMessage()); alert.show(); } }
private void doMenu() { if (mMenu.isShowing()) { mMenu.hide(); } else { // Note it doesn't matter what widget you send the menu as long as // it gets view. View v = new View(Calender.this); mMenu.show(v); } }
private void intiliaze() { pb = (ProgressBar) findViewById(R.id.pb); mGridView = (GridView) findViewById(R.id.cal_gridview); month = Calendar.getInstance(); adapter = new NotesCalendarAdapter(month); mGridView.setAdapter(adapter); TextView title = (TextView) findViewById(R.id.title); title.setText(android.text.format.DateFormat.format("MMMM yyyy", month)); ImageView previous = (ImageView) findViewById(R.id.previous); ImageView next = (ImageView) findViewById(R.id.next); previous.setOnClickListener(this); next.setOnClickListener(this); mMenu = new CustomMenu(Calender.this, Calender.this, getLayoutInflater()); mMenu.setHideOnSelect(true); mMenu.setItemsPerLineInPortraitOrientation(3); mMenu.setItemsPerLineInLandscapeOrientation(8); loadMenuItems(); }