Java 类android.view.Menu 实例源码

项目:openlocate-android    文件:MainActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (showReloadPlacesButton) {
        getMenuInflater().inflate(R.menu.main_menu, menu);
        final MenuItem myActionMenuItem = menu.findItem(R.id.action_refresh);
        myActionMenuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                PlaceFragment placeFragment = (PlaceFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container);
                if (placeFragment.isAdded()) {
                    placeFragment.currentPlace();
                }
                return false;
            }
        });
    }
    return super.onCreateOptionsMenu(menu);
}
项目:iSPY    文件:TrackerActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_switch, menu);

    // Get the action view used in your toggleservice item
    final MenuItem toggle = menu.findItem(R.id.menu_switch);
    mSwitch = (SwitchCompat) toggle.getActionView().findViewById(R.id.switchInActionBar);
    mSwitch.setEnabled(mTransportIdEditText.length() > 0 && mEmailEditText.length() > 0 &&
            mPasswordEditText.length() > 0);
    mSwitch.setChecked(mStartButton.getVisibility() != View.VISIBLE);
    mSwitch.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (((SwitchCompat) v).isChecked()) {
                checkInputFields();
            } else {
                confirmStop();
            }
        }
    });
    return super.onCreateOptionsMenu(menu);
}
项目:MKAPP    文件:ActivityMain.java   
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    if (prefs.getBoolean("manage_system", false)) {
        menu.findItem(R.id.menu_app_user).setChecked(prefs.getBoolean("show_user", true));
        menu.findItem(R.id.menu_app_system).setChecked(prefs.getBoolean("show_system", false));
    } else {
        Menu submenu = menu.findItem(R.id.menu_filter).getSubMenu();
        submenu.removeItem(R.id.menu_app_user);
        submenu.removeItem(R.id.menu_app_system);
    }

    menu.findItem(R.id.menu_app_nointernet).setChecked(prefs.getBoolean("show_nointernet", true));
    menu.findItem(R.id.menu_app_disabled).setChecked(prefs.getBoolean("show_disabled", true));

    String sort = prefs.getString("sort", "name");
    if ("uid".equals(sort))
        menu.findItem(R.id.menu_sort_uid).setChecked(true);
    else
        menu.findItem(R.id.menu_sort_name).setChecked(true);

    menu.findItem(R.id.menu_lockdown).setChecked(prefs.getBoolean("lockdown", false));

    return super.onPrepareOptionsMenu(menu);
}
项目:Espresso    文件:PackagesAdapter.java   
/**
 * Create the context menu.
 * @param menu The context menu.
 * @param v The view.
 * @param menuInfo The menu information.
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (menu != null) {
        ((MainActivity)context).setSelectedPackageId(list.get(getLayoutPosition()).getNumber());
        Package pack = list.get(getLayoutPosition());
        menu.setHeaderTitle(pack.getName());
        // Set different title according to the data({@link Package#readable})
        if (pack.isReadable()) {
            menu.add(Menu.NONE, R.id.action_set_readable, 0, R.string.set_read);
        } else {
            menu.add(Menu.NONE, R.id.action_set_readable, 0, R.string.set_unread);
        }
        menu.add(Menu.NONE, R.id.action_copy_code, 0, R.string.copy_code);
        menu.add(Menu.NONE, R.id.action_share, 0, R.string.share);
    }
}
项目:ProgressManager    文件:a.java   
/**
 * Default implementation of
 * {@link android.view.Window.Callback#onPanelClosed(int, Menu)} for
 * activities. This calls through to {@link #onOptionsMenuClosed(Menu)}
 * method for the {@link android.view.Window#FEATURE_OPTIONS_PANEL} panel,
 * so that subclasses of Activity don't need to deal with feature codes.
 * For context menus ({@link Window#FEATURE_CONTEXT_MENU}), the
 * {@link #onContextMenuClosed(Menu)} will be called.
 */
public void onPanelClosed(int featureId, Menu menu) {
    switch (featureId) {
        case Window.FEATURE_OPTIONS_PANEL:
            mFragments.dispatchOptionsMenuClosed(menu);
            onOptionsMenuClosed(menu);
            break;

        case Window.FEATURE_CONTEXT_MENU:
            onContextMenuClosed(menu);
            break;

        case Window.FEATURE_ACTION_BAR:
            initWindowDecorActionBar();
            mActionBar.dispatchMenuVisibilityChanged(false);
            break;
    }
}
项目:OSchina_resources_android    文件:QuestionDetailActivity.java   
@SuppressLint("SetTextI18n")
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_question_detail, menu);
        MenuItem item = menu.findItem(R.id.menu_comment);
        if (item != null) {
            View action = item.getActionView();
            if (action != null) {
                View tv = action.findViewById(R.id.tv_comment_count);
                if (tv != null) {
                    mCommentCountView = (TextView) tv;
                    if (mBean.getStatistics() != null)
                        mCommentCountView.setText(mBean.getStatistics().getComment() + "");
                }
            }
        }
//        MenuItem menuItem = menu.findItem(R.id.menu_report);
//        DrawableCompat.setTint(menuItem.getIcon(),Color.WHITE);
        return true;
    }
项目:YZxing    文件:ScannerActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (isEnableScanFromPicture) {
        getMenuInflater().inflate(R.menu.menu_scan, menu);
        return true;
    } else {
        return super.onCreateOptionsMenu(menu);
    }
}
项目:navigator    文件:MainView.java   
public boolean onCreateOptionsMenu(Menu menu) {
    if(root != null && root.getChildAt(0) != null) {
        Key key = backstackHolder.getBackstack().getKey(root.getChildAt(0).getContext());
        MainActivity.get(getContext()).getMenuInflater().inflate(key.menu(), menu);
        return true;
    }
    return false;
}
项目:SOS-The-Healthcare-Companion    文件:BaseFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    MenuItem item = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
    searchView.setOnQueryTextListener(this);
}
项目:Remindy    文件:HomeListFragment.java   
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    mode.getMenuInflater().inflate (R.menu.menu_home_contextual, menu);
    menu.findItem(R.id.home_contextual_done).setVisible( (mReminderTypeToDisplay == ViewPagerTaskDisplayType.PROGRAMMED) );
    menu.findItem(R.id.home_contextual_not_done).setVisible( (mReminderTypeToDisplay == ViewPagerTaskDisplayType.DONE) );
    return true;
}
项目:Nird2    文件:ConversationActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.conversation_actions, menu);

    enableIntroductionActionIfAvailable(
            menu.findItem(R.id.action_introduction));

    return super.onCreateOptionsMenu(menu);
}
项目:ProgressManager    文件:a.java   
/**
 * {@inheritDoc}
 *
 * @return The default implementation returns true.
 */
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR) {
        initWindowDecorActionBar();
        if (mActionBar != null) {
            mActionBar.dispatchMenuVisibilityChanged(true);
        } else {
            Log.e(TAG, "Tried to open action bar menu with no action bar");
        }
    }
    return true;
}
项目:rental-calc    文件:PictureViewActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
    getMenuInflater().inflate(R.menu.picture_view_menu, menu);

    // Locate MenuItem with ShareActionProvider
    MenuItem item = menu.findItem(R.id.action_share);

    // Fetch ShareActionProvider
    ShareActionProvider shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
    if (shareActionProvider == null)
    {
        Log.w(TAG, "Failed to find share action provider");
        return false;
    }

    if(imageFilename == null)
    {
        Log.w(TAG, "No receipt to share");
        return false;
    }

    Intent shareIntent = new Intent(Intent.ACTION_SEND);

    // Determine mimetype of image
    BitmapFactory.Options opt = new BitmapFactory.Options();
    opt.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(imageFilename, opt);
    shareIntent.setType(opt.outMimeType);

    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imageFilename)));
    shareActionProvider.setShareIntent(shareIntent);

    return super.onCreateOptionsMenu(menu);
}
项目:LiteReader    文件:ZhihuStoryDetailViewModel.java   
@Override
public boolean onCreateOptionMenu(Menu menu) {
    this.menu = menu;
    getSelfView().getCompatActivity().getMenuInflater().inflate(R.menu.menu_common, menu);
    initCollect();
    return true;
}
项目:NanoIconPack    文件:AppAdapter.java   
@Override
public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
    contextMenu.setHeaderTitle(dataList.get(contextMenuActiveItemPos).getLabel());
    contextMenu.add(Menu.NONE, 0, Menu.NONE, R.string.menu_request_icon);
    contextMenu.add(Menu.NONE, 1, Menu.NONE, R.string.menu_copy_code);
    contextMenu.add(Menu.NONE, 2, Menu.NONE, R.string.menu_save_icon);
    contextMenu.getItem(0).setOnMenuItemClickListener(this);
    contextMenu.getItem(1).setOnMenuItemClickListener(this);
    contextMenu.getItem(2).setOnMenuItemClickListener(this);

    contextMenu.getItem(0).setVisible(enableStatsModule);
}
项目:Swift-Braille-Soft-keyboard    文件:SettingsActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    try{
        MenuInflater menuInflater = getMenuInflater();
        menuInflater.inflate(R.menu.settings_menu, menu);
    } catch(Exception e){
        e.printStackTrace();
    }

    return super.onCreateOptionsMenu(menu);
}
项目:AndroidAsyncHTTP    文件:SampleParentActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, MENU_USE_HTTPS, Menu.NONE, R.string.menu_use_https).setCheckable(true);
    menu.add(Menu.NONE, MENU_CLEAR_VIEW, Menu.NONE, R.string.menu_clear_view);
    menu.add(Menu.NONE, MENU_ENABLE_LOGGING, Menu.NONE, "Enable Logging").setCheckable(true);
    menu.add(Menu.NONE, MENU_LOGGING_VERBOSITY, Menu.NONE, "Set Logging Verbosity");
    return super.onCreateOptionsMenu(menu);
}
项目:BookED    文件:ProfileFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.profilemenu,menu);

    MenuItem logout = menu.findItem(R.id.logout);
    super.onCreateOptionsMenu(menu, inflater);
}
项目:OpenYOLO-Android    文件:NeverSaveListActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    //hide the lock icon in this case
    menu.getItem(1).setVisible(false);
    return true;
}
项目:SimpleNotes    文件:MultiChoiceImplementation.java   
@Override
//Здесь надуваем наше меню из xml
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
    Log.d(TAG, "onCreateActionMode");
    MenuInflater inflater = actionMode.getMenuInflater();
    inflater.inflate(R.menu.action_mode_menu, menu);
    return true;
}
项目:Rey-MusicPlayer    文件:SongsFragment.java   
@Override
public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    menu.clear();
    getActivity().getMenuInflater().inflate(R.menu.menu_song, menu);

    if (PreferencesHelper.getInstance().getString(PreferencesHelper.Key.SONG_SORT_TYPE, Constants.ASCENDING).equalsIgnoreCase(Constants.ASCENDING)) {
        menu.findItem(R.id.sort_song_type).setChecked(true);
    } else {
        menu.findItem(R.id.sort_song_type).setChecked(false);
    }

    String songSortOrder = PreferencesHelper.getInstance().getString(PreferencesHelper.Key.SONG_SORT_ORDER, SortOrder.SongSortOrder.SONG_DEFAULT);

    if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DEFAULT)) {
        menu.findItem(R.id.sort_song_default).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DISPLAY_NAME)) {
        menu.findItem(R.id.sort_song_name).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_TRACK_NO)) {
        menu.findItem(R.id.sort_song_track_no).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DURATION)) {
        menu.findItem(R.id.sort_song_duration).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_YEAR)) {
        menu.findItem(R.id.sort_song_year).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DATE)) {
        menu.findItem(R.id.sort_song_date_added).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_ALBUM)) {
        menu.findItem(R.id.sort__song_album_name).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_ARTIST)) {
        menu.findItem(R.id.sort_song_artist_name).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_FILENAME)) {
        menu.findItem(R.id.sort_song_file_name).setChecked(true);
    }

}
项目:GitHub    文件:MediaVariationsFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.fragment_imagepipeline_media_variations, menu);

  menu.findItem(mMode.menuItemId).setChecked(true);

  super.onCreateOptionsMenu(menu, inflater);
}
项目:aos-Video    文件:BrowserBySeason.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {

    super.onCreateOptionsMenu(menu, inflater);
    if (mBrowserAdapter != null
            && !mBrowserAdapter.isEmpty()) {
        mDisplayModeSubmenu.clear();
        mDisplayModeSubmenu.addSubmenuItem(R.drawable.ic_menu_list_mode2, R.string.view_mode_list, 0);
        mDisplayModeSubmenu.addSubmenuItem(R.drawable.ic_menu_grid_mode, R.string.view_mode_grid, 0);
        mDisplayModeSubmenu.selectSubmenuItem(mViewMode == VideoUtils.VIEW_MODE_GRID
                ? SUBMENU_ITEM_GRID_INDEX : SUBMENU_ITEM_LIST_INDEX);
    }

}
项目:AndroidAsyncHTTP    文件:SampleParentActivity.java   
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem useHttpsMenuItem = menu.findItem(MENU_USE_HTTPS);
    if (useHttpsMenuItem != null) {
        useHttpsMenuItem.setChecked(useHttps);
    }
    MenuItem enableLoggingMenuItem = menu.findItem(MENU_ENABLE_LOGGING);
    if (enableLoggingMenuItem != null) {
        enableLoggingMenuItem.setChecked(enableLogging);
    }
    return super.onPrepareOptionsMenu(menu);
}
项目:chat-sdk-android-push-firebase    文件:ChatSDKAbstractChatActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {

    if (!inflateMenuItems)
        return super.onCreateOptionsMenu(menu);

    // Adding the add user option only if group chat is enabled.
    if (BDefines.Options.GroupEnabled)
    {
        MenuItem item =
                menu.add(Menu.NONE, R.id.action_chat_sdk_add, 10, getString(R.string.chat_activity_show_users_item_text));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        item.setIcon(R.drawable.ic_plus);
    }

    if (BDefines.Options.ThreadDetailsEnabled)
    {

        MenuItem itemThreadUsers =
            menu.add(Menu.NONE, R.id.action_chat_sdk_thread_details, 10, getString(R.string.chat_activity_show_thread_details));

        itemThreadUsers.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        itemThreadUsers.setIcon(android.R.drawable.ic_menu_info_details);
    }

    return super.onCreateOptionsMenu(menu);
}
项目:ImageClassify    文件:TopBarBaseActivity.java   
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (!TextUtils.isEmpty(menuStr)){
        menu.findItem(R.id.menu_1).setTitle(menuStr);
    }
    return super.onPrepareOptionsMenu(menu);
}
项目:DinningShare    文件:CordovaActivity.java   
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (appView != null) {
        appView.getPluginManager().postMessage("onPrepareOptionsMenu", menu);
    }
    return true;
}
项目:zabbkit-android    文件:GraphFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem shareMenuItem = menu.add(0, ID_MENU_SHARE, 0, R.string.menu_share).setIcon(R.drawable.ic_menu_share);
    MenuItem saveMenuItem = menu.add(0, ID_MENU_SAVE, 0, R.string.menu_save).setIcon(android.R.drawable.ic_menu_save);
    MenuItem bookmarkMenuItem = menu.add(0, ID_MENU_BOOKMARK, 0, R.string.menu_bookmark).setIcon(android.R.drawable.star_big_off);
    MenuItemCompat.setShowAsAction(shareMenuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    MenuItemCompat.setShowAsAction(saveMenuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    MenuItemCompat.setShowAsAction(bookmarkMenuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    super.onCreateOptionsMenu(menu, inflater);
}
项目:q-mail    文件:ChooseFolder.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.folder_select_option, menu);
    configureFolderSearchView(menu);
    return true;
}
项目:GitHub    文件:ConsoleActivity.java   
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    setVolumeControlStream(AudioManager.STREAM_NOTIFICATION);

    final TerminalView view = adapter.getCurrentTerminalView();
    boolean activeTerminal = view != null;
    boolean sessionOpen = false;
    boolean disconnected = false;
    boolean canForwardPorts = false;

    if (activeTerminal) {
        TerminalBridge bridge = view.bridge;
        sessionOpen = bridge.isSessionOpen();
        disconnected = bridge.isDisconnected();
        canForwardPorts = bridge.canFowardPorts();
    }

    disconnect.setEnabled(activeTerminal);
    if (sessionOpen || !disconnected)
        disconnect.setTitle(R.string.list_host_disconnect);
    else
        disconnect.setTitle(R.string.console_menu_close);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        copy.setEnabled(activeTerminal);
    }
    paste.setEnabled(activeTerminal);
    portForward.setEnabled(sessionOpen && canForwardPorts);
    urlscan.setEnabled(activeTerminal);
    resize.setEnabled(sessionOpen);

    return true;
}
项目:Treebolic    文件:ProvidersActivity.java   
@Override
public boolean onCreateOptionsMenu(final Menu menu)
{
    // inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.providers, menu);
    return true;
}
项目:q-mail    文件:MessageList.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.message_list_option, menu);
    mMenu = menu;
    mMenuButtonCheckMail= menu.findItem(R.id.check_mail);
    return true;
}
项目:buildAPKsSamples    文件:FoldingLayoutActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (IS_JBMR2) {
        getMenuInflater().inflate(R.menu.fold_with_bug, menu);
    } else {
        getMenuInflater().inflate(R.menu.fold, menu);
    }
    Spinner s = (Spinner) menu.findItem(R.id.num_of_folds).getActionView();
    s.setOnItemSelectedListener(mItemSelectedListener);
    return true;
}
项目:Library-System-Android    文件:CreateClass.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}
项目:RetroMusicPlayer    文件:FoldersFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.menu_folders, menu);
    ToolbarContentTintHelper.handleOnCreateOptionsMenu(getActivity(), toolbar, menu, ATHToolbarActivity.getToolbarBackgroundColor(toolbar));
}
项目:nucleus-test    文件:FormularioActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_lista_cliente, menu);
    return super.onCreateOptionsMenu(menu);
}
项目:zabbkit-android    文件:OverviewFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem item = menu.add(0, MENU_SETTING, 100, R.string.action_settings).setIcon(R.drawable.ic_menu_servers);
    MenuItemCompat.setShowAsAction(item, 2);
    super.onCreateOptionsMenu(menu, inflater);
}
项目:boohee_v5.6    文件:SpecialLessonDetailActivity.java   
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.q, menu);
    this.menu = menu;
    return true;
}
项目:School1-Android    文件:ConfigCourseActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.config_course, menu);
    return true;
}
项目:AwesomeImagePicker    文件:MainActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}