Java Code Examples for androidx.fragment.app.FragmentActivity#invalidateOptionsMenu()
The following examples show how to use
androidx.fragment.app.FragmentActivity#invalidateOptionsMenu() .
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: MainFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 6 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentActivity activity = getActivity(); if (activity != null) { // ViewModels //mPeripheralModeViewModel = ViewModelProviders.of(activity).get(PeripheralModeViewModel.class); // Note: shares viewModel with Activity // update options menu with current values activity.invalidateOptionsMenu(); // Setup when activity is created for the first time if (!mIsInitialNavigationItemSelected) { // Set initial value //mNavigationView.setSelectedItemId(R.id.navigation_central); selectFragment(R.id.navigation_central); mIsInitialNavigationItemSelected = true; } } }
Example 2
Source File: AboutFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 6 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Update ActionBar setActionBarTitle(R.string.about_title); TextView versionTextView = view.findViewById(R.id.versionTextView); if (versionTextView != null) { versionTextView.setText(String.format("v%s", BuildConfig.VERSION_NAME)); } FragmentActivity activity = getActivity(); if (activity != null) { activity.invalidateOptionsMenu(); // update options menu with current values } }
Example 3
Source File: GeopaparazziActivityFragment.java From geopaparazzi with GNU General Public License v3.0 | 6 votes |
private void onGpsServiceUpdate(Intent intent) { mLastGpsServiceStatus = GpsServiceUtilities.getGpsServiceStatus(intent); mLastGpsLoggingStatus = GpsServiceUtilities.getGpsLoggingStatus(intent); int[] mLastGpsStatusExtras = GpsServiceUtilities.getGpsStatusExtras(intent); mLastGpsPosition = GpsServiceUtilities.getPosition(intent); // lastGpsPositionExtras = GpsServiceUtilities.getPositionExtras(intent); // lastPositiontime = GpsServiceUtilities.getPositionTime(intent); boolean doLog = GPLog.LOG_HEAVY; if (doLog && mLastGpsStatusExtras != null) { int satCount = mLastGpsStatusExtras[1]; int satForFixCount = mLastGpsStatusExtras[2]; GPLog.addLogEntry(this, "satellites: " + satCount + " of which for fix: " + satForFixCount);//NON-NLS } FragmentActivity activity = getActivity(); if (activity != null) activity.invalidateOptionsMenu(); }
Example 4
Source File: SpyglassRobolectricRunner.java From Spyglass with Apache License 2.0 | 5 votes |
public static void startFragment(Fragment fragment, FragmentActivity activity, String tag) { FragmentManager fragmentManager = activity.getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.add(fragment, tag); fragmentTransaction.commit(); fragmentManager.executePendingTransactions(); activity.invalidateOptionsMenu(); }