android.os.Bundle.getBundle()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(244)

本文整理了Java中android.os.Bundle.getBundle()方法的一些代码示例,展示了Bundle.getBundle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getBundle()方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getBundle

Bundle.getBundle介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

/**
 * The referer data associated with the app link. This will contain Facebook specific
 * information like fb_access_token, fb_expires_in, and fb_ref.
 *
 * @return the referer data.
 */
public Bundle getRefererData() {
  if (argumentBundle != null) {
    return argumentBundle.getBundle(ARGUMENTS_REFERER_DATA_KEY);
  }
  return null;
}

代码示例来源:origin: bluelinelabs/Conductor

RouterTransaction(@NonNull Bundle bundle) {
  controller = Controller.newInstance(bundle.getBundle(KEY_VIEW_CONTROLLER_BUNDLE));
  pushControllerChangeHandler = ControllerChangeHandler.fromBundle(bundle.getBundle(KEY_PUSH_TRANSITION));
  popControllerChangeHandler = ControllerChangeHandler.fromBundle(bundle.getBundle(KEY_POP_TRANSITION));
  tag = bundle.getString(KEY_TAG);
  transactionIndex = bundle.getInt(KEY_INDEX);
  attachedToRouter = bundle.getBoolean(KEY_ATTACHED_TO_ROUTER);
}

代码示例来源:origin: bluelinelabs/Conductor

@Override @NonNull
protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
  return onCreateView(inflater, container, viewState == null ? null : viewState.getBundle(KEY_VIEW_STATE_BUNDLE));
}

代码示例来源:origin: konmik/nucleus

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (savedInstanceState != null)
    presenterDelegate.onRestoreInstanceState(savedInstanceState.getBundle(PRESENTER_STATE_KEY));
}

代码示例来源:origin: konmik/nucleus

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (savedInstanceState != null)
    presenterDelegate.onRestoreInstanceState(savedInstanceState.getBundle(PRESENTER_STATE_KEY));
}

代码示例来源:origin: konmik/nucleus

@Override
public void onCreate(Bundle bundle) {
  super.onCreate(bundle);
  if (bundle != null)
    presenterDelegate.onRestoreInstanceState(bundle.getBundle(PRESENTER_STATE_KEY));
}

代码示例来源:origin: konmik/nucleus

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (savedInstanceState != null)
    presenterDelegate.onRestoreInstanceState(savedInstanceState.getBundle(PRESENTER_STATE_KEY));
}

代码示例来源:origin: bluelinelabs/Conductor

@Nullable
public static ControllerChangeHandler fromBundle(@Nullable Bundle bundle) {
  if (bundle != null) {
    String className = bundle.getString(KEY_CLASS_NAME);
    ControllerChangeHandler changeHandler = ClassUtils.newInstance(className);
    //noinspection ConstantConditions
    changeHandler.restoreFromBundle(bundle.getBundle(KEY_SAVED_STATE));
    return changeHandler;
  } else {
    return null;
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

public static Bundle getErrorDataFromResultIntent(Intent resultIntent) {
  if (!isErrorResult(resultIntent)) {
    return null;
  }
  Bundle bridgeArgs = getBridgeArgumentsFromIntent(resultIntent);
  if (bridgeArgs != null) {
    return bridgeArgs.getBundle(BRIDGE_ARG_ERROR_BUNDLE);
  }
  return resultIntent.getExtras();
}

代码示例来源:origin: facebook/facebook-android-sdk

public static Bundle getSuccessResultsFromIntent(Intent resultIntent) {
  int version = getProtocolVersionFromIntent(resultIntent);
  Bundle extras = resultIntent.getExtras();
  if (!isVersionCompatibleWithBucketedIntent(version) || extras == null) {
    return extras;
  }
  return extras.getBundle(EXTRA_PROTOCOL_METHOD_RESULTS);
}

代码示例来源:origin: konmik/nucleus

@Override
protected void onRestoreInstanceState(Parcelable state) {
  Bundle bundle = (Bundle) state;
  super.onRestoreInstanceState(bundle.getParcelable(PARENT_STATE_KEY));
  presenterDelegate.onRestoreInstanceState(bundle.getBundle(PRESENTER_STATE_KEY));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 protected void onRestoreInstanceState(Bundle state) {
  super.onRestoreInstanceState(state);

  adapter.onRestoreInstanceState(state.getBundle(STATE_ADAPTER));
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 protected void onRestoreInstanceState(Bundle state) {
  super.onRestoreInstanceState(state);

  adapter.onRestoreInstanceState(state.getBundle(STATE_ADAPTER));
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 protected void onRestoreInstanceState(Bundle state) {
  super.onRestoreInstanceState(state);

  adapter.onRestoreInstanceState(state.getBundle(STATE_ADAPTER));
 }
}

代码示例来源:origin: bluelinelabs/Conductor

@Override
public void restoreFromBundle(@NonNull Bundle bundle) {
  super.restoreFromBundle(bundle);
  String className = bundle.getString(KEY_CHANGE_HANDLER_CLASS);
  changeHandler = ClassUtils.newInstance(className);
  //noinspection ConstantConditions
  changeHandler.restoreFromBundle(bundle.getBundle(KEY_HANDLER_STATE));
}

代码示例来源:origin: konmik/nucleus

@Override
public void onCreate(Bundle bundle) {
  super.onCreate(bundle);
  if (bundle != null)
    presenterDelegate.onRestoreInstanceState(bundle.getBundle(PRESENTER_STATE_KEY));
}

代码示例来源:origin: bluelinelabs/Conductor

private void restoreViewState(@NonNull View view) {
  if (viewState != null) {
    view.restoreHierarchyState(viewState.getSparseParcelableArray(KEY_VIEW_STATE_HIERARCHY));
    Bundle savedViewState = viewState.getBundle(KEY_VIEW_STATE_BUNDLE);
    savedViewState.setClassLoader(getClass().getClassLoader());
    onRestoreViewState(view, savedViewState);
    restoreChildControllerHosts();
    List<LifecycleListener> listeners = new ArrayList<>(lifecycleListeners);
    for (LifecycleListener lifecycleListener : listeners) {
      lifecycleListener.onRestoreViewState(this, viewState);
    }
  }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
protected void onRestoreInstanceState(Bundle state) {
 super.onRestoreInstanceState(state);
 adapter.onRestoreInstanceState(state.getBundle(STATE_ADAPTER));
 tabs.removeAllTabs();
 for (int i=0;i<adapter.getItemCount();i++) {
  tabs.addTab(tabs.newTab().setText(adapter.getTabText(i)));
 }
}

代码示例来源:origin: hidroh/materialistic

@Override
public void onActivityCreated(Bundle savedInstanceState) {
  super.onActivityCreated(savedInstanceState);
  if (savedInstanceState != null) {
    getAdapter().restoreState(savedInstanceState.getBundle(STATE_ADAPTER));
  }
  getAdapter().setCardViewEnabled(Preferences.isListItemCardView(getActivity()));
  getAdapter().setCustomTabsDelegate(mCustomTabsDelegate);
  mRecyclerView.setAdapter(getAdapter());
  mScrollableHelper = new KeyDelegate.RecyclerViewHelper(mRecyclerView,
      KeyDelegate.RecyclerViewHelper.SCROLL_PAGE);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getWrongType() {
 bundle.putFloat("foo", 5f);
 assertThat(bundle.getCharArray("foo")).isNull();
 assertThat(bundle.getInt("foo")).isEqualTo(0);
 assertThat(bundle.getIntArray("foo")).isNull();
 assertThat(bundle.getIntegerArrayList("foo")).isNull();
 assertThat(bundle.getShort("foo")).isEqualTo((short) 0);
 assertThat(bundle.getShortArray("foo")).isNull();
 assertThat(bundle.getBoolean("foo")).isFalse();
 assertThat(bundle.getBooleanArray("foo")).isNull();
 assertThat(bundle.getLong("foo")).isEqualTo(0);
 assertThat(bundle.getLongArray("foo")).isNull();
 assertThat(bundle.getFloatArray("foo")).isNull();
 assertThat(bundle.getDouble("foo")).isEqualTo(0.0);
 assertThat(bundle.getDoubleArray("foo")).isNull();
 assertThat(bundle.getString("foo")).isNull();
 assertThat(bundle.getStringArray("foo")).isNull();
 assertThat(bundle.getStringArrayList("foo")).isNull();
 assertThat(bundle.getBundle("foo")).isNull();
 assertThat((Parcelable) bundle.getParcelable("foo")).isNull();
 assertThat(bundle.getParcelableArray("foo")).isNull();
 assertThat(bundle.getParcelableArrayList("foo")).isNull();
 bundle.putInt("foo", 1);
 assertThat(bundle.getFloat("foo")).isEqualTo(0.0f);
}

相关文章

Bundle类方法