android.app.Fragment#getArguments ( )源码实例Demo

下面列出了android.app.Fragment#getArguments ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: buck   文件: ExoHelper.java
/**
 * 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();
}
 
源代码2 项目: edslite   文件: PropertiesView.java
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));
}
 
源代码3 项目: OkDeepLink   文件: BundleCompact.java
private static Bundle getBundle(Fragment fragment) {

        if (fragment == null || fragment.getArguments() == null) {
            return null;
        }
        return fragment.getArguments();

    }
 
源代码4 项目: MiPushFramework   文件: AppHeader.java
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;
}