@Override public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) { int result; if (outSpecificItems != null) { android.view.MenuItem[] nativeOutItems = new android.view.MenuItem[outSpecificItems.length]; result = mNativeMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, nativeOutItems); for (int i = 0, length = outSpecificItems.length; i < length; i++) { outSpecificItems[i] = new MenuItemWrapper(nativeOutItems[i]); } } else { result = mNativeMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, null); } return result; }
@Override public boolean onCreateOptionsMenu(Menu menu){ super.onCreateOptionsMenu(menu); // Create an Intent that describes the requirements to fulfill, to be included // in our menu. The offering app must include a category value of Intent.CATEGORY_ALTERNATIVE. Intent intent = new Intent(null, dataUri); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); // Search and populate the menu with acceptable offering applications. menu.addIntentOptions( R.id.intent_group, // Menu group to which new items will be added 0, // Unique item ID (none) 0, // Order for the items (none) this.getComponentName(), // The current Activity name null, // Specific items to place first (none) intent, // Intent created above that describes our requirements 0, // Additional flags to control items (none) null); // Array of MenuItems that correlate to specific items (none) return true; }
@Override public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) { android.view.MenuItem[] nativeOutItems = new android.view.MenuItem[outSpecificItems.length]; int result = mNativeMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, nativeOutItems); for (int i = 0, length = outSpecificItems.length; i < length; i++) { outSpecificItems[i] = new MenuItemWrapper(nativeOutItems[i]); } return result; }
menu.addIntentOptions(menuGroup, menuItemId, menuItemOrder,
@Override public boolean onCreateOptionsMenu(Menu menu) { // This is our one standard application action -- inserting a // new note into the list. menu.add(0, MENU_ITEM_SAVE, 0, R.string.save) .setShortcut('1', 's') .setIcon(R.drawable.ic_save); menu.add(0, MENU_ITEM_CANCEL, 1, android.R.string.cancel) .setShortcut('3', 'c') .setIcon(R.drawable.ic_close); // Generate any additional actions that can be performed on the // overall list. In a normal install, there are no additional // actions found here, but this allows other applications to extend // our menu with their own actions. Intent intent = new Intent(null, getIntent().getData()); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, new ComponentName(this, SudokuEditActivity.class), null, intent, 0, null); return true; }
menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, new ComponentName(this, SudokuListActivity.class), null, intent, 0, null);
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // This is our one standard application action -- inserting a // new note into the list. menu.add(0, MENU_ITEM_ADD, 0, R.string.add_folder) .setShortcut('3', 'a') .setIcon(R.drawable.ic_add); menu.add(0, MENU_ITEM_IMPORT, 0, R.string.import_file) .setShortcut('8', 'i') .setIcon(R.drawable.ic_cloud_upload); menu.add(0, MENU_ITEM_EXPORT_ALL, 1, R.string.export_all_folders) .setShortcut('7', 'e') .setIcon(R.drawable.ic_share); menu.add(0, MENU_ITEM_SETTINGS, 2, R.string.settings) .setShortcut('6', 's') .setIcon(R.drawable.ic_settings); menu.add(0, MENU_ITEM_ABOUT, 2, R.string.about) .setShortcut('1', 'h') .setIcon(R.drawable.ic_info); // Generate any additional actions that can be performed on the // overall list. In a normal install, there are no additional // actions found here, but this allows other applications to extend // our menu with their own actions. Intent intent = new Intent(null, getIntent().getData()); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, new ComponentName(this, FolderListActivity.class), null, intent, 0, null); return true; }
menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, new ComponentName(this, SudokuPlayActivity.class), null, intent, 0, null);