本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例11: putIntArray
import android.os.Bundle; //导入方法依赖的package包/类
public void putIntArray(Bundle state, String key, int[] x) {
state.putIntArray(key + baseKey, x);
}
示例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));
}
示例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];
}
示例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);
}
}
}
}
示例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
}