Java Code Examples for android.support.v4.app.Fragment#onOptionsItemSelected()
The following examples show how to use
android.support.v4.app.Fragment#onOptionsItemSelected() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From OmniList with GNU Affero General Public License v3.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { Fragment fragment = getCurrentFragment(); if (!fragment.onOptionsItemSelected(item)) { getBinding().drawerLayout.openDrawer(GravityCompat.START); } return true; } case R.id.action_search: SearchActivity.start(this, REQUEST_SEARCH); break; } return super.onOptionsItemSelected(item); }
Example 2
Source File: BaseListActivity.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { Fragment fragment = getCurrentFragment(); if (!fragment.onOptionsItemSelected(item)) { getBinding().drawerLayout.openDrawer(GravityCompat.START); } return true; } } return super.onOptionsItemSelected(item); }
Example 3
Source File: FreightTrackMapActivity.java From ESeal with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_main); if (fragment != null) { return fragment.onOptionsItemSelected(item); } return super.onOptionsItemSelected(item); }
Example 4
Source File: SingleFragmentActivity.java From standardlib with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container); if (null != currentFragment && currentFragment.onOptionsItemSelected(item)) { return true; } else { finish(); return true; } } else { return super.onOptionsItemSelected(item); } }