当前位置: 首页>>代码示例>>Java>>正文


Java Bundle.putIntArray方法代码示例

本文整理汇总了Java中android.os.Bundle.putIntArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putIntArray方法的具体用法?Java Bundle.putIntArray怎么用?Java Bundle.putIntArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.putIntArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Parcelable p = this.mFragments.saveAllState();
    if (p != null) {
        outState.putParcelable(FRAGMENTS_TAG, p);
    }
    if (this.mPendingFragmentActivityResults.size() > 0) {
        outState.putInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG, this.mNextCandidateRequestIndex);
        int[] requestCodes = new int[this.mPendingFragmentActivityResults.size()];
        String[] fragmentWhos = new String[this.mPendingFragmentActivityResults.size()];
        for (int i = 0; i < this.mPendingFragmentActivityResults.size(); i++) {
            requestCodes[i] = this.mPendingFragmentActivityResults.keyAt(i);
            fragmentWhos[i] = (String) this.mPendingFragmentActivityResults.valueAt(i);
        }
        outState.putIntArray(ALLOCATED_REQUEST_INDICIES_TAG, requestCodes);
        outState.putStringArray(REQUEST_FRAGMENT_WHO_TAG, fragmentWhos);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:FragmentActivity.java

示例2: create

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Create the {@link ColorPickerDialog} instance.
 *
 * @return A new {@link ColorPickerDialog}.
 * @see #show(Activity)
 */
public ColorPickerDialog create() {
  ColorPickerDialog dialog = new ColorPickerDialog();
  Bundle args = new Bundle();
  args.putInt(ARG_ID, dialogId);
  args.putInt(ARG_TYPE, dialogType);
  args.putInt(ARG_COLOR, color);
  args.putIntArray(ARG_PRESETS, presets);
  args.putBoolean(ARG_ALPHA, showAlphaSlider);
  args.putBoolean(ARG_ALLOW_CUSTOM, allowCustom);
  args.putBoolean(ARG_ALLOW_PRESETS, allowPresets);
  args.putInt(ARG_DIALOG_TITLE, dialogTitle);
  args.putBoolean(ARG_SHOW_COLOR_SHADES, showColorShades);
  args.putInt(ARG_COLOR_SHAPE, colorShape);
  dialog.setArguments(args);
  return dialog;
}
 
开发者ID:tateisu,项目名称:SubwayTooter,代码行数:23,代码来源:ColorPickerDialog.java

示例3: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // Get the SetGame
    SetGame game = mActionsListener.getSetGame();

    SparseBooleanArray checkedItemPositions = getCheckedItemPositions();
    int positionIndex = 0;
    // Loop through SparseBooleanArray and grab the positions that are checked
    for (int i = 0; i < checkedItemPositions.size(); i++) {
        if (checkedItemPositions.valueAt(i)) {
            mCheckedPositions[positionIndex] = checkedItemPositions.keyAt(i);
            positionIndex++;
        }
    }

    // Bundle objects
    outState.putParcelable(getString(R.string.bundle_key_game), Parcels.wrap(game));
    outState.putIntArray(getString(R.string.bundle_key_checked_positions), mCheckedPositions);
    outState.putInt(getString(R.string.bundle_key_checked_count), mCheckedCount);
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:23,代码来源:GameFragment.java

示例4: saveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public final void saveInstanceState(@NonNull final Bundle outState) {
    outState.putSerializable(LOG_LEVEL_EXTRA, logLevel);
    outState.putParcelableArrayList(TABS_EXTRA, tabs);
    outState.putBoolean(SWITCHER_SHOWN_EXTRA, switcherShown);
    outState.putInt(SELECTED_TAB_INDEX_EXTRA, selectedTab != null ? indexOf(selectedTab) : -1);
    outState.putIntArray(PADDING_EXTRA, padding);
    outState.putBoolean(APPLY_PADDING_TO_TABS_EXTRA, applyPaddingToTabs);
    outState.putInt(TAB_ICON_ID_EXTRA, tabIconId);
    outState.putParcelable(TAB_ICON_BITMAP_EXTRA, tabIconBitmap);
    outState.putParcelable(TAB_BACKGROUND_COLOR_EXTRA, tabBackgroundColor);
    outState.putInt(TAB_CONTENT_BACKGROUND_COLOR_EXTRA, tabContentBackgroundColor);
    outState.putParcelable(TAB_TITLE_TEXT_COLOR_EXTRA, tabTitleTextColor);
    outState.putInt(TAB_CLOSE_BUTTON_ICON_ID_EXTRA, tabCloseButtonIconId);
    outState.putParcelable(TAB_CLOSE_BUTTON_ICON_BITMAP_EXTRA, tabCloseButtonIconBitmap);
    outState.putInt(TAB_PROGRESS_BAR_COLOR_EXTRA, tabProgressBarColor);
    outState.putBoolean(SHOW_TOOLBARS_EXTRA, showToolbars);
    outState.putCharSequence(TOOLBAR_TITLE_EXTRA, toolbarTitle);
    getContentRecyclerAdapter().saveInstanceState(outState);
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:21,代码来源:TabSwitcherModel.java

示例5: startSecondFragment

import android.os.Bundle; //导入方法依赖的package包/类
private void startSecondFragment(int type, View view) {
  SharedTargetFragment fragment = SharedTargetFragment.newInstance(type);
  Bundle bundle = fragment.getArguments();
  int[] screenLocation = new int[2];
  view.getLocationOnScreen(screenLocation);
  bundle.putIntArray(BUNDLE_KEY + 1, screenLocation);
  bundle.putIntArray(BUNDLE_KEY + 2, new int[]{view.getWidth(), view.getHeight()});
  switch (type) {
    case TYPE_HAMMER:
      break;
    case TYPE_HOURGLASS:
      break;
    case TYPE_SEND:
      break;
    case TYPE_CLOUD:
      break;
  }
  Rigger.getRigger(this).startFragment(fragment);
}
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:20,代码来源:SharedElementFragment.java

示例6: saveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public final void saveInstanceState(@NonNull final Bundle outState) {
    outState.putSerializable(LOG_LEVEL_EXTRA, logLevel);
    outState.putParcelableArrayList(TABS_EXTRA, tabs);
    outState.putBoolean(SWITCHER_SHOWN_EXTRA, switcherShown);
    outState.putParcelable(SELECTED_TAB_EXTRA, selectedTab);
    outState.putIntArray(PADDING_EXTRA, padding);
    outState.putInt(TAB_ICON_ID_EXTRA, tabIconId);
    outState.putParcelable(TAB_ICON_BITMAP_EXTRA, tabIconBitmap);
    outState.putParcelable(TAB_BACKGROUND_COLOR_EXTRA, tabBackgroundColor);
    outState.putParcelable(TAB_TITLE_TEXT_COLOR_EXTRA, tabTitleTextColor);
    outState.putInt(TAB_CLOSE_BUTTON_ICON_ID_EXTRA, tabCloseButtonIconId);
    outState.putParcelable(TAB_CLOSE_BUTTON_ICON_BITMAP_EXTRA, tabCloseButtonIconBitmap);
    outState.putBoolean(SHOW_TOOLBARS_EXTRA, showToolbars);
    outState.putCharSequence(TOOLBAR_TITLE_EXTRA, toolbarTitle);
    childRecyclerAdapter.saveInstanceState(outState);
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:18,代码来源:TabSwitcherModel.java

示例7: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    this.spinnerSavedInstanceState = new int[]{
            this.spinnerHour.getSelectedItemPosition(),
            this.spinnerMinute.getSelectedItemPosition(),
            this.spinnerSecond.getSelectedItemPosition(),
    };
    outState.putIntArray(String.valueOf(this.getId()), spinnerSavedInstanceState);
}
 
开发者ID:brolam,项目名称:OpenHomeAnalysis,代码行数:11,代码来源:TimeFragment.java

示例8: fromArrayToBundle

import android.os.Bundle; //导入方法依赖的package包/类
public static void fromArrayToBundle(Bundle bundle, String key, Object array) {
    if (bundle != null && !TextUtils.isEmpty(key) && array != null) {
        if (array instanceof String[]) {
            bundle.putStringArray(key, (String[]) ((String[]) array));
        } else if (array instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) ((byte[]) array));
        } else if (array instanceof short[]) {
            bundle.putShortArray(key, (short[]) ((short[]) array));
        } else if (array instanceof int[]) {
            bundle.putIntArray(key, (int[]) ((int[]) array));
        } else if (array instanceof long[]) {
            bundle.putLongArray(key, (long[]) ((long[]) array));
        } else if (array instanceof float[]) {
            bundle.putFloatArray(key, (float[]) ((float[]) array));
        } else if (array instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) ((double[]) array));
        } else if (array instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) ((boolean[]) array));
        } else if (array instanceof char[]) {
            bundle.putCharArray(key, (char[]) ((char[]) array));
        } else {
            if (!(array instanceof JSONArray)) {
                throw new IllegalArgumentException("Unknown array type " + array.getClass());
            }

            ArrayList arraylist = new ArrayList();
            JSONArray jsonArray = (JSONArray) array;
            Iterator it = jsonArray.iterator();

            while (it.hasNext()) {
                JSONObject object = (JSONObject) it.next();
                arraylist.add(fromJsonToBundle(object));
            }

            bundle.putParcelableArrayList(key, arraylist);
        }

    }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:40,代码来源:ArgumentsUtil.java

示例9: saveManagedDialogs

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Save the state of any managed dialogs.
 *
 * @param outState place to store the saved state.
 */
private void saveManagedDialogs(Bundle outState) {
    if (mManagedDialogs == null) {
        return;
    }

    final int numDialogs = mManagedDialogs.size();
    if (numDialogs == 0) {
        return;
    }

    Bundle dialogState = new Bundle();

    int[] ids = new int[mManagedDialogs.size()];

    // save each dialog's bundle, gather the ids
    for (int i = 0; i < numDialogs; i++) {
        final int key = mManagedDialogs.keyAt(i);
        ids[i] = key;
        final ManagedDialog md = mManagedDialogs.valueAt(i);
        dialogState.putBundle(savedDialogKeyFor(key), md.mDialog.onSaveInstanceState());
        if (md.mArgs != null) {
            dialogState.putBundle(savedDialogArgsKeyFor(key), md.mArgs);
        }
    }

    dialogState.putIntArray(SAVED_DIALOG_IDS_KEY, ids);
    outState.putBundle(SAVED_DIALOGS_TAG, dialogState);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:34,代码来源:a.java

示例10: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    int[] values = new int[mAdjustmentViews.size()];
    for (int i = 0, l = values.length; i < l; i++) {
        values[i] = mAdjustmentViews.get(i).getValue();
    }

    outState.putIntArray(KEY_VALUES, values);
}
 
开发者ID:unixzii,项目名称:android-SpringAnimator,代码行数:12,代码来源:BaseAdjustmentFragment.java

示例11: putIntArray

import android.os.Bundle; //导入方法依赖的package包/类
public void putIntArray(Bundle state, String key, int[] x) {
    state.putIntArray(key + baseKey, x);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Injector.java

示例12: write

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException {
    Field propertyField = field.getField();
    propertyField.setAccessible(true);
    bundle.putIntArray(field.getBundleKey(), (int[]) propertyField.get(to));
}
 
开发者ID:leobert-lan,项目名称:MagicBox,代码行数:7,代码来源:IntArrayWriter.java

示例13: messageboxShowMessageBox

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * This method is called by SDL using JNI.
 * Shows the messagebox from UI thread and block calling thread.
 * buttonFlags, buttonIds and buttonTexts must have same length.
 * @param buttonFlags array containing flags for every button.
 * @param buttonIds array containing id for every button.
 * @param buttonTexts array containing text for every button.
 * @param colors null for default or array of length 5 containing colors.
 * @return button id or -1.
 */
public int messageboxShowMessageBox(
        final int flags,
        final String title,
        final String message,
        final int[] buttonFlags,
        final int[] buttonIds,
        final String[] buttonTexts,
        final int[] colors) {

    messageboxSelection[0] = -1;

    // sanity checks

    if ((buttonFlags.length != buttonIds.length) && (buttonIds.length != buttonTexts.length)) {
        return -1; // implementation broken
    }

    // collect arguments for Dialog

    final Bundle args = new Bundle();
    args.putInt("flags", flags);
    args.putString("title", title);
    args.putString("message", message);
    args.putIntArray("buttonFlags", buttonFlags);
    args.putIntArray("buttonIds", buttonIds);
    args.putStringArray("buttonTexts", buttonTexts);
    args.putIntArray("colors", colors);

    // trigger Dialog creation on UI thread

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            showDialog(dialogs++, args);
        }
    });

    // block the calling thread

    synchronized (messageboxSelection) {
        try {
            messageboxSelection.wait();
        } catch (InterruptedException ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    // return selected value

    return messageboxSelection[0];
}
 
开发者ID:jomof,项目名称:cdep-android-studio-freetype-sample,代码行数:63,代码来源:SDLActivity.java

示例14: onReceive

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    if (DEBUG) log("Broadcast received: " + intent.toString());
    if (intent.getAction().equals(ACTION_GET_AUTOBRIGHTNESS_CONFIG) &&
            intent.hasExtra("receiver")) {
        ResultReceiver receiver = intent.getParcelableExtra("receiver");
        Bundle data = new Bundle();
        Resources res = context.getResources();
        data.putIntArray("config_autoBrightnessLevels",
                res.getIntArray(res.getIdentifier(
                        "config_autoBrightnessLevels", "array", "android")));
        data.putIntArray("config_autoBrightnessLcdBacklightValues",
                res.getIntArray(res.getIdentifier(
                        "config_autoBrightnessLcdBacklightValues", "array", "android")));
        receiver.send(RESULT_AUTOBRIGHTNESS_CONFIG, data);
    } else if (intent.getAction().equals(ACTION_SET_AUTOBRIGHTNESS_CONFIG)) {
        int[] luxArray = intent.getIntArrayExtra("config_autoBrightnessLevels");
        int[] brightnessArray = intent.getIntArrayExtra("config_autoBrightnessLcdBacklightValues");
        updateAutobrightnessConfig(luxArray, brightnessArray);
    } else if (intent.getAction().equals(GravityBoxSettings.ACTION_PREF_BUTTON_BACKLIGHT_CHANGED)) {
        if (intent.hasExtra(GravityBoxSettings.EXTRA_BB_MODE)) {
            mButtonBacklightMode = intent.getStringExtra(GravityBoxSettings.EXTRA_BB_MODE);
            updateButtonBacklight();
        }
        if (intent.hasExtra(GravityBoxSettings.EXTRA_BB_NOTIF)) {
            mButtonBacklightNotif = intent.getBooleanExtra(GravityBoxSettings.EXTRA_BB_NOTIF, false);
            if (!mButtonBacklightNotif) {
                updateButtonBacklight();
            }
        }
    } else if ((intent.getAction().equals(Intent.ACTION_SCREEN_ON)
            || intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) &&
            !mButtonBacklightMode.equals(GravityBoxSettings.BB_MODE_DEFAULT)) {
        updateButtonBacklight(intent.getAction().equals(Intent.ACTION_SCREEN_ON));
    } else if (intent.getAction().equals(GravityBoxSettings.ACTION_PREF_LOCKSCREEN_BG_CHANGED) &&
            intent.hasExtra(GravityBoxSettings.EXTRA_LOCKSCREEN_BG)) {
        mLsBgLastScreenEnabled = intent.getStringExtra(GravityBoxSettings.EXTRA_LOCKSCREEN_BG)
                .equals(GravityBoxSettings.LOCKSCREEN_BG_LAST_SCREEN);
        if (DEBUG_KIS) log("mLsBgLastScreenEnabled = " + mLsBgLastScreenEnabled);
    } else if (intent.getAction().equals(GravityBoxSettings.ACTION_BATTERY_LED_CHANGED) &&
            intent.hasExtra(GravityBoxSettings.EXTRA_BLED_CHARGING)) {
        ChargingLed cg = ChargingLed.valueOf(intent.getStringExtra(GravityBoxSettings.EXTRA_BLED_CHARGING));
        if (cg == ChargingLed.EMULATED || cg == ChargingLed.CONSTANT) {
            resetLight(LIGHT_ID_BATTERY);
        }
        mChargingLed = cg;
        if (!mPendingNotif) {
            resetLight(LIGHT_ID_NOTIFICATIONS);
        }
    } else if (intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED)) {
        boolean charging = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0;
        int level = (int) (100f * intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0)
                / intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100));
        if (mCharging != charging || mBatteryLevel != level) {
            mCharging = charging;
            mBatteryLevel = level;
            if ((mChargingLed == ChargingLed.EMULATED || mChargingLed == ChargingLed.CONSTANT) &&
                    !mPendingNotif) {
                resetLight(LIGHT_ID_NOTIFICATIONS);
            }
        }
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:64,代码来源:ModDisplay.java

示例15: onSaveState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveState(Bundle bundle) {
    super.onSaveState(bundle);
    bundle.putIntArray(LOOKUP_BUNDLE_KEY, mLazySpanLookup.mData);
    // TODO: store span info
}
 
开发者ID:alibaba,项目名称:vlayout,代码行数:7,代码来源:StaggeredGridLayoutHelper.java


注:本文中的android.os.Bundle.putIntArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。