public I arg(String key, int[] value) { args.putIntArray(key, value); return (I) this; }
/** * Choose what set of gestures will be enabled on each tab - if any. */ public void setAllowedGestures(@UCropActivity.GestureTypes int tabScale, @UCropActivity.GestureTypes int tabRotate, @UCropActivity.GestureTypes int tabAspectRatio) { mOptionBundle.putIntArray(EXTRA_ALLOWED_GESTURES, new int[]{tabScale, tabRotate, tabAspectRatio}); }
/** * Inserts an int array value 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 int array object, or null */ public Bundler putIntArray(String key, int[] value) { bundle.putIntArray(key, value); return this; }
/** * Inserts an int array value 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 int array object, or null */ public Bundler putIntArray(String key, int[] value) { bundle.putIntArray(key, value); return this; }
/** * Inserts an int array value 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 int array object, or null * @return this bundler instance to chain method calls */ public Bundler put(String key, int[] value) { delegate.putIntArray(key, value); return this; }
public BundleBuilder putIntArray(String key, int[] value) { bundle.putIntArray(key, value); return this; }
/** * Sets an array of int values in the object. * @param key The key for the value. * @param value The value. * @return The builder. */ public E putIntArray(final String key, @Nullable final int[] value) { this.bundle.putIntArray(key, value); return (E)this; }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putIntArray(KEY_COLORS, mColors); outState.putSerializable(KEY_SELECTED_COLOR, mSelectedColor); } }
@Override public Parcelable saveState() { Bundle bundle = new Bundle(); bundle.putBoolean(KEY_SAVES_STATE, savesState); bundle.putSparseParcelableArray(KEY_SAVED_PAGES, savedPages); int[] visiblePageIdsKeys = new int[visiblePageIds.size()]; String[] visiblePageIdsValues = new String[visiblePageIds.size()]; for (int i = 0; i < visiblePageIds.size(); i++) { visiblePageIdsKeys[i] = visiblePageIds.keyAt(i); visiblePageIdsValues[i] = visiblePageIds.valueAt(i); } bundle.putIntArray(KEY_VISIBLE_PAGE_IDS_KEYS, visiblePageIdsKeys); bundle.putStringArray(KEY_VISIBLE_PAGE_IDS_VALUES, visiblePageIdsValues); return bundle; }
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); boolean hasFirstRefresh; if (mHelper != null && 1 == mHelper.getShownViewIndex()) { hasFirstRefresh = false; } else { hasFirstRefresh = mHasFirstRefresh; } outState.putBoolean(KEY_HAS_FIRST_REFRESH, hasFirstRefresh); outState.putParcelable(KEY_URL_BUILDER, mUrlBuilder); outState.putBoolean(KEY_SEARCH_MODE, mSearchMode); outState.putIntArray(KEY_FAV_COUNT_ARRAY, mFavCountArray); }
private static void putIntArray(String key, Bundle bundle) { int length = random.nextInt(50); int[] array = new int[length]; for (int i = 0; i < length; i++) { array[i] = random.nextInt(); } bundle.putIntArray(key, array); }
private void showPreferences() { Bundle args = new Bundle(); args.putInt(PopupSettingsFragment.EXTRA_TITLE, R.string.list_display_options); args.putInt(PopupSettingsFragment.EXTRA_SUMMARY, R.string.pull_up_hint); args.putIntArray(PopupSettingsFragment.EXTRA_XML_PREFERENCES, new int[]{ R.xml.preferences_font, R.xml.preferences_list}); ((DialogFragment) Fragment.instantiate(getActivity(), PopupSettingsFragment.class.getName(), args)) .show(getFragmentManager(), PopupSettingsFragment.class.getName()); }
private void showPreferences() { Bundle args = new Bundle(); args.putInt(PopupSettingsFragment.EXTRA_TITLE, R.string.font_options); args.putInt(PopupSettingsFragment.EXTRA_SUMMARY, R.string.pull_up_hint); args.putIntArray(PopupSettingsFragment.EXTRA_XML_PREFERENCES, new int[]{ R.xml.preferences_font, R.xml.preferences_comments}); ((DialogFragment) Fragment.instantiate(getActivity(), PopupSettingsFragment.class.getName(), args)) .show(getFragmentManager(), PopupSettingsFragment.class.getName()); }
private void onComplete(int requestCode, String[] permissions, int[] grantResult) { Bundle bundle = new Bundle(); bundle.putStringArray("permissions", permissions); bundle.putIntArray("grantResult", grantResult); bundle.putInt("requestCode", requestCode); // Send our callback to the result receiver resultReceiver.send(requestCode, bundle); finish(); }
private void showPreferences() { Bundle args = new Bundle(); args.putInt(PopupSettingsFragment.EXTRA_TITLE, R.string.font_options); args.putIntArray(PopupSettingsFragment.EXTRA_XML_PREFERENCES, new int[]{R.xml.preferences_readability}); ((DialogFragment) Fragment.instantiate(getActivity(), PopupSettingsFragment.class.getName(), args)) .show(getFragmentManager(), PopupSettingsFragment.class.getName()); }
ss.putIntArray("viewTops", mPendingSync.viewTops); ss.putInt("position", mPendingSync.position); ss.putInt("height", mPendingSync.height); viewTops[i] = getChildAt(i).getTop(); ss.putIntArray("viewTops", viewTops); } else { ss.putInt("viewTop", 0); ss.putLong("firstId", INVALID_POSITION); ss.putInt("position", 0); ss.putIntArray("viewTops", new int[1]);
public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) { if (value == null) { bundle.remove(key); } else if (value instanceof Boolean) { bundle.putBoolean(key, (boolean) value); } else if (value instanceof boolean[]) { bundle.putBooleanArray(key, (boolean[]) value); } else if (value instanceof Double) { bundle.putDouble(key, (double) value); } else if (value instanceof double[]) { bundle.putDoubleArray(key, (double[]) value); } else if (value instanceof Integer) { bundle.putInt(key, (int) value); } else if (value instanceof int[]) { bundle.putIntArray(key, (int[]) value); } else if (value instanceof Long) { bundle.putLong(key, (long) value); } else if (value instanceof long[]) { bundle.putLongArray(key, (long[]) value); } else if (value instanceof String) { bundle.putString(key, (String) value); } else if (value instanceof JSONArray) { bundle.putString(key, value.toString()); } else if (value instanceof JSONObject) { bundle.putString(key, value.toString()); } else { return false; } return 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); }
array[i] = jsonArray.getInt(i); bundle.putIntArray(key, array); } else if (valueType.equals(TYPE_LONG)) { bundle.putLong(key, json.getLong(JSON_VALUE));
@Test public void intArray() { int [] arr = new int[] { 87, 65 }; bundle.putIntArray("foo", arr); assertThat(bundle.getIntArray("foo")).isEqualTo(arr); assertThat(bundle.getIntArray("bar")).isNull(); }