Fragment onOptionsItemSelected - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Fragment onOptionsItemSelected method.

This code example shows how to use the following methods:getActivity, onOptionsItemSelected, startActivity
        MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
 
    } 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
    	 Intent intent = new Intent(getActivity().getBaseContext(), SettingsActivity.class);
         startActivity(intent);
      return super.onOptionsItemSelected(item);
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getActivity, onOptionsItemSelected
	} 
 
	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
 
		Toast.makeText(getActivity(), "Fragment Menu Item", Toast.LENGTH_SHORT)
				.show();
 
		return super.onOptionsItemSelected(item);
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:onOptionsItemSelected
            } 
            if (item.getTitle().equals("Menu 1b")) {
                Toast.makeText(getActivity(), "Selected Menu 1b.", Toast.LENGTH_SHORT).show();
                return true; 
            } 
            return super.onOptionsItemSelected(item);
        } 
    } 
 
    /** 
     * Second fragment with a menu. 
     */ 
    public static class Menu2Fragment extends Fragment {
        Menu3Fragment mFragment3;
 
        @Override 
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setHasOptionsMenu(true);
 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:onOptionsItemSelected
        pointcutManager.onPrepareOptionsMenu(menu); 
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) { 
        return pointcutManager.onOptionsItemSelected(item) || super.onOptionsItemSelected(item); 
    } 
 
    @Override 
    public void onOptionsMenuClosed(Menu menu) { 
        super.onOptionsMenuClosed(menu); 
        pointcutManager.onOptionsMenuClosed(menu); 
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:onOptionsItemSelected
				mFakeTask = new FakeTask();
				mFakeTask.execute();
			} 
			return true; 
		} 
		return super.onOptionsItemSelected(item);
	} 
 
	@Override 
	public void onPause() { 
		super.onPause(); 
		 
		if (mFakeTask != null) {
			mFakeTask.cancel(true);
			mFakeTask = null;
		} 
	} 
 
	/** 
	 * Shows and hides the loading indicator 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:onOptionsItemSelected
        super.onCreateOptionsMenu(menu, inflater);
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        return super.onOptionsItemSelected(item);
    } 
 
    private boolean onHelloLongPress() { 
        ((ActionBarActivity) getActivity()).startSupportActionMode(this);
        return true; 
    } 
 
    @Override 
    public boolean onQueryTextSubmit(String s) {
        Log.i(TAG, "Search Submit: " + s);
        return true; 
    } 
 
    @Override 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:onOptionsItemSelected
	} 
 
	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub 
		return super.onOptionsItemSelected(item);
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
onOptionsItemSelected Method Overview
This hook is called whenever an item in your options menu is selected.
See Code Examples for other Android Fragment Methods: