Code example for MenuItem

Methods: getTitle

        return super.onPrepareOptionsMenu(menu);
    public boolean onOptionsItemSelected(MenuItem item) {
        Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show();
        return true; 
    // This method is specified as an onClick handler in the menu xml and will 
    // take precedence over the Activity's onOptionsItemSelected method. 
    // See res/menu/actions.xml for more info. 
    public void onSort(MenuItem item) {
        mSortMode = item.getItemId();
        // Request a call to onPrepareOptionsMenu so we can change the sort icon 
    // The following callbacks are called for the SearchView.OnQueryChangeListener 
    // For more about using SearchView, see src/.../view/ and