public I arg(String key, Parcelable[] value) { args.putParcelableArray(key, value); return (I) this; }
@Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_INSTANCE_STATE_PENDING_REQUEST, mPendingRequest); if (mPendingRequest == REQUEST_ADD_ACCOUNT) { outState.putParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS, mExistingAccounts); } if (mSelectedItemIndex != SELECTED_ITEM_NONE) { if (mSelectedItemIndex == mAccounts.size()) { outState.putBoolean(KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, true); } else { outState.putBoolean(KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, false); outState.putString(KEY_INSTANCE_STATE_SELECTED_ACCOUNT_NAME, mAccounts.get(mSelectedItemIndex).name); } } outState.putParcelableArrayList(KEY_INSTANCE_STATE_ACCOUNT_LIST, mAccounts); }
/** * Inserts an array of Parcelable values into the mapping of this Bundle, * replacing any existing value for the given key. Either key or value may * be null. * * @param key a String, or null * @param value an array of Parcelable objects, or null */ public Bundler putParcelableArray(String key, Parcelable[] value) { bundle.putParcelableArray(key, value); return this; }
/** * Inserts an array of Parcelable values into the mapping of this Bundle, * replacing any existing value for the given key. Either key or value may * be null. * * @param key a String, or null * @param value an array of Parcelable objects, or null */ public Bundler putParcelableArray(String key, Parcelable[] value) { bundle.putParcelableArray(key, value); return this; }
/** * Inserts an array of Parcelable values into the mapping of the underlying Bundle, replacing any * existing value for the given key. Either key or value may be null. * * @param key a String, or null * @param value an array of Parcelable objects, or null * @return this bundler instance to chain method calls */ public Bundler put(String key, Parcelable[] value) { delegate.putParcelableArray(key, value); return this; }
public BundleBuilder putParcelableArray(String key, Parcelable[] value) { bundle.putParcelableArray(key, value); return this; }
@Override public Parcelable saveState() { Bundle state = new Bundle(); state.putParcelableArray("states", savedStates); return state; }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelableArray(ARG_EMOJICONS, mEmojicons); }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putLong(KEY_API_UID, mApiUid); outState.putString(KEY_API_KEY, mApiKey); outState.putLong(KEY_GID, mGid); outState.putString(KEY_TOKEN, mToken); outState.putParcelableArray(KEY_COMMENTS, mComments); }
static Bundle getArguments(@LayoutRes int pageLayoutRes, @NonNull TransformItem[] transformItems) { Bundle args = new Bundle(); args.putInt(EXTRA_PAGE_LAYOUT_RES, pageLayoutRes); args.putParcelableArray(EXTRA_TRANSFORM_ITEMS, ValidationUtil.checkNotNull(transformItems)); return args; }
public static AspectRatioFragment newInstance(Set<AspectRatio> ratios, AspectRatio currentRatio) { final AspectRatioFragment fragment = new AspectRatioFragment(); final Bundle args = new Bundle(); args.putParcelableArray(ARG_ASPECT_RATIOS, ratios.toArray(new AspectRatio[ratios.size()])); args.putParcelable(ARG_CURRENT_ASPECT_RATIO, currentRatio); fragment.setArguments(args); return fragment; }
public static LicenseFragment newInstance(SoftwareComponent[] softwareComponents) { if(softwareComponents == null) { throw new NullPointerException("softwareComponents is null"); } LicenseFragment fragment = new LicenseFragment(); Bundle bundle = new Bundle(); bundle.putParcelableArray(ARG_COMPONENTS, softwareComponents); fragment.setArguments(bundle); return fragment; }
@Override public Parcelable saveState() { Bundle state = null; if (mSavedState.size() > 0) { state = new Bundle(); Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()]; mSavedState.toArray(fss); state.putParcelableArray("states", fss); } for (int i = 0; i < mFragments.size(); i++) { Fragment f = mFragments.get(i); if (f != null && f.isAdded()) { if (state == null) { state = new Bundle(); } String key = "f" + i; mFragmentManager.putFragment(state, key, f); } } return state; }
public void sendResult() { IAccountManagerResponse response = getResponseAndClose(); if (response != null) { try { Account[] accounts = new Account[mAccountsWithFeatures.size()]; for (int i = 0; i < accounts.length; i++) { accounts[i] = mAccountsWithFeatures.get(i); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response " + response); } Bundle result = new Bundle(); result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts); response.onResult(result); } catch (RemoteException e) { // if the caller is dead then there is no one to care about remote exceptions Log.v(TAG, "failure while notifying response", e); } } }
@Override public Parcelable saveState() { Bundle state = null; if (mSavedState.size() > 0) { state = new Bundle(); Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()]; mSavedState.toArray(fss); state.putParcelableArray("states", fss); } for (int i=0; i<mFragments.size(); i++) { Fragment f = mFragments.get(i); if (f != null && f.isAdded()) { if (state == null) { state = new Bundle(); } String key = "f" + i; mFragmentManager.putFragment(state, key, f); } } return state; }
protected static EmojiconGridFragment newInstance( @Emojicon.Type int type, Emojicon[] emojicons, EmojiconRecents recents, boolean useSystemDefault) { EmojiconGridFragment emojiGridFragment = new EmojiconGridFragment(); Bundle args = new Bundle(); args.putInt(ARG_EMOJICON_TYPE, type); args.putParcelableArray(ARG_EMOJICONS, emojicons); args.putBoolean(ARG_USE_SYSTEM_DEFAULTS, useSystemDefault); emojiGridFragment.setArguments(args); emojiGridFragment.setRecents(recents); return emojiGridFragment; }
private void onCommentGallerySuccess(GalleryComment[] result) { if (null == mAdapter) { return; } mComments = result; mAdapter.notifyDataSetChanged(); Bundle re = new Bundle(); re.putParcelableArray(KEY_COMMENTS, result); setResult(SceneFragment.RESULT_OK, re); // Remove text if (mEditText != null) { mEditText.setText(""); } updateView(true); }
private static void writeContentUriTriggerToBundle(Bundle data, ContentUriTrigger uriTrigger) { data.putInt(BundleProtocol.PACKED_PARAM_TRIGGER_TYPE, BundleProtocol.TRIGGER_TYPE_CONTENT_URI); int size = uriTrigger.getUris().size(); int[] flagsArray = new int[size]; Uri[] uriArray = new Uri[size]; for (int i = 0; i < size; i++) { ObservedUri uri = uriTrigger.getUris().get(i); flagsArray[i] = uri.getFlags(); uriArray[i] = uri.getUri(); } data.putIntArray(BundleProtocol.PACKED_PARAM_CONTENT_URI_FLAGS_ARRAY, flagsArray); data.putParcelableArray(BundleProtocol.PACKED_PARAM_CONTENT_URI_ARRAY, uriArray); }
@Override public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) { if (response == null) throw new IllegalArgumentException("response is null"); if (type == null) throw new IllegalArgumentException("accountType is null"); AuthenticatorInfo info = getAuthenticatorInfo(type); if (info == null) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } return; } if (features == null || features.length == 0) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type)); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } } else { new GetAccountsByTypeAndFeatureSession(response, userId, info, features).bind(); } }
@Test public void parcelableArray() { Bundle innerBundle = new Bundle(); innerBundle.putInt("value", 1); Parcelable[] arr = new Parcelable[] { innerBundle }; bundle.putParcelableArray("foo", arr); assertThat(bundle.getParcelableArray("foo")).isEqualTo(arr); assertThat(bundle.getParcelableArray("bar")).isNull(); } }