Java Code Examples for android.app.Fragment#getArguments()
The following examples show how to use
android.app.Fragment#getArguments() .
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: ExoHelper.java From buck with Apache License 2.0 | 6 votes |
/** * Try refreshing the given Fragment in place, preserving construction args. The new Fragment will * be constructed via a fresh class lookup. This method must be called from the UI thread * * @param fragment the fragment to refresh * @param preserveState if true, attempt to save the Fragment's current state and restore it to * the new instance of the fragment */ public static void refreshFragment(Fragment fragment, boolean preserveState) { assertIsUiThread(); FragmentManager manager = fragment.getFragmentManager(); final Bundle args = fragment.getArguments(); Fragment replacement = createFragment(fragment.getClass().getName(), args); String tag = fragment.getTag(); if (preserveState) { // Restore any state that's possible final SavedState savedState = manager.saveFragmentInstanceState(fragment); replacement.setInitialSavedState(savedState); } int containerViewId = ((View) fragment.getView().getParent()).getId(); final FragmentTransaction transaction = manager.beginTransaction(); transaction.remove(fragment); if (tag != null) { transaction.add(containerViewId, replacement, tag); } else { transaction.add(containerViewId, replacement); } transaction.commit(); }
Example 2
Source File: PropertiesView.java From edslite with GNU General Public License v2.0 | 5 votes |
public static PropertyEditor getProperty(Fragment f) { PropertyEditor.Host host = getHost(f); return host == null || f.getArguments() == null || !f.getArguments().containsKey(PropertyEditor.ARG_PROPERTY_ID) ? null : host.getPropertiesView().getPropertyById(f.getArguments().getInt(PropertyEditor.ARG_PROPERTY_ID)); }
Example 3
Source File: BundleCompact.java From OkDeepLink with Apache License 2.0 | 5 votes |
private static Bundle getBundle(Fragment fragment) { if (fragment == null || fragment.getArguments() == null) { return null; } return fragment.getArguments(); }
Example 4
Source File: AppHeader.java From MiPushFramework with GNU General Public License v3.0 | 5 votes |
public static boolean includeAppInfo(final Fragment fragment) { Bundle args = fragment.getArguments(); boolean showInfo = true; if (args != null && args.getBoolean(EXTRA_HIDE_INFO_BUTTON, false)) { showInfo = false; } Intent intent = fragment.getActivity().getIntent(); if (intent != null && intent.getBooleanExtra(EXTRA_HIDE_INFO_BUTTON, false)) { showInfo = false; } return showInfo; }