本文整理了Java中android.os.Bundle.getIntArray()
方法的一些代码示例,展示了Bundle.getIntArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getIntArray()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getIntArray
暂无
代码示例来源:origin: stackoverflow.com
Bundle extras = getIntent().getExtras();
int[] arrayInB = extras.getIntArray("my_array");
代码示例来源:origin: facebook/facebook-android-sdk
/**
* Gets an array of int values out of the object.
* @param key The key for the value.
* @return The int values.
*/
@Nullable
public int[] getIntArray(final String key) {
return this.bundle.getIntArray(key);
}
代码示例来源:origin: seven332/EhViewer
private void onRestore(Bundle savedInstanceState) {
mUrlBuilder = savedInstanceState.getParcelable(KEY_URL_BUILDER);
if (mUrlBuilder == null) {
mUrlBuilder = new FavListUrlBuilder();
}
mSearchMode = savedInstanceState.getBoolean(KEY_SEARCH_MODE);
mHasFirstRefresh = savedInstanceState.getBoolean(KEY_HAS_FIRST_REFRESH);
mFavCountArray = savedInstanceState.getIntArray(KEY_FAV_COUNT_ARRAY);
}
代码示例来源:origin: bluelinelabs/Conductor
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
Bundle bundle = (Bundle)state;
if (state != null) {
savesState = bundle.getBoolean(KEY_SAVES_STATE, false);
savedPages = bundle.getSparseParcelableArray(KEY_SAVED_PAGES);
int[] visiblePageIdsKeys = bundle.getIntArray(KEY_VISIBLE_PAGE_IDS_KEYS);
String[] visiblePageIdsValues = bundle.getStringArray(KEY_VISIBLE_PAGE_IDS_VALUES);
visiblePageIds = new SparseArray<>(visiblePageIdsKeys.length);
for (int i = 0; i < visiblePageIdsKeys.length; i++) {
visiblePageIds.put(visiblePageIdsKeys[i], visiblePageIdsValues[i]);
}
}
}
代码示例来源:origin: chentao0707/SimplifyReader
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
mDataChanged = true;
mSyncHeight = bundle.getInt("height");
long firstId = bundle.getLong("firstId");
if (firstId >= 0) {
mNeedSync = true;
SavedState ss = new SavedState();
ss.firstId = firstId;
ss.height = (int) mSyncHeight;
ss.position = bundle.getInt("position");
ss.viewTop = bundle.getInt("viewTop");
ss.childCount = bundle.getInt("childCount");
ss.viewTops = bundle.getIntArray("viewTops");
mPendingSync = ss;
mSyncRowId = ss.firstId;
mSyncPosition = ss.position;
mSpecificTop = ss.viewTop;
mSpecificTops = ss.viewTops;
}
state = bundle.getParcelable("instanceState");
}
super.onRestoreInstanceState(state);
requestLayout();
}
}//end of class
代码示例来源:origin: iSoron/uhabits
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mTitleResId = getArguments().getInt(KEY_TITLE_ID);
mColumns = getArguments().getInt(KEY_COLUMNS);
mSize = getArguments().getInt(KEY_SIZE);
}
if (savedInstanceState != null) {
mColors = savedInstanceState.getIntArray(KEY_COLORS);
mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR);
}
}
代码示例来源:origin: robolectric/robolectric
@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();
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
super.onReceiveResult(resultCode, resultData);
int[] grantResult = resultData.getIntArray("grantResult");
String[] permissions = resultData.getStringArray("permissions");
// Call the callback with the result
callback.onComplete(new PermissionResponse(permissions, grantResult, resultCode));
}
};
代码示例来源:origin: konmik/nucleus
when(bundle.getIntArray(anyString())).thenAnswer(get);
代码示例来源:origin: Yalantis/uCrop
int[] allowedGestures = bundle.getIntArray(UCrop.Options.EXTRA_ALLOWED_GESTURES);
if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
mAllowedGestures = allowedGestures;
代码示例来源:origin: hidroh/materialistic
@Override
public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.preferences_category);
Preference category = findPreference(getString(R.string.pref_category));
int summary, title;
if ((title = getArguments().getInt(EXTRA_TITLE, 0)) != 0) {
category.setTitle(title);
}
if ((summary = getArguments().getInt(EXTRA_SUMMARY, 0)) != 0) {
category.setSummary(summary);
}
int[] preferences = getArguments().getIntArray(EXTRA_XML_PREFERENCES);
if (preferences != null) {
for (int preference : preferences) {
addPreferencesFromResource(preference);
}
}
}
}
代码示例来源: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);
}
代码示例来源:origin: firebase/firebase-jobdispatcher-android
@Test
public void testWriteToBundle_contentUriTrigger() {
ObservedUri observedUri =
new ObservedUri(ContactsContract.AUTHORITY_URI, Flags.FLAG_NOTIFY_FOR_DESCENDANTS);
ContentUriTrigger contentUriTrigger = Trigger.contentUriTrigger(Arrays.asList(observedUri));
Bundle bundle =
writer.writeToBundle(
initializeDefaultBuilder().setTrigger(contentUriTrigger).build(), new Bundle());
Uri[] uris = (Uri[]) bundle.getParcelableArray(BundleProtocol.PACKED_PARAM_CONTENT_URI_ARRAY);
int[] flags = bundle.getIntArray(BundleProtocol.PACKED_PARAM_CONTENT_URI_FLAGS_ARRAY);
assertTrue("Array size", uris.length == flags.length && flags.length == 1);
assertEquals(
BundleProtocol.PACKED_PARAM_CONTENT_URI_ARRAY, ContactsContract.AUTHORITY_URI, uris[0]);
assertEquals(
BundleProtocol.PACKED_PARAM_CONTENT_URI_FLAGS_ARRAY,
Flags.FLAG_NOTIFY_FOR_DESCENDANTS,
flags[0]);
}
代码示例来源:origin: stackoverflow.com
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
final int[] position = savedInstanceState.getIntArray("ARTICLE_SCROLL_POSITION");
if(position != null)
mScrollView.post(new Runnable() {
public void run() {
mScrollView.scrollTo(position[0], position[1]);
}
});
}
代码示例来源:origin: facebook/facebook-android-sdk
assertArrayEquals(originalBundle.getShortArray(SHORT_ARRAY_KEY), cachedBundle.getShortArray(SHORT_ARRAY_KEY));
assertEquals(originalBundle.getInt(INT_KEY), cachedBundle.getInt(INT_KEY));
assertArrayEquals(originalBundle.getIntArray(INT_ARRAY_KEY), cachedBundle.getIntArray(INT_ARRAY_KEY));
assertEquals(originalBundle.getLong(LONG_KEY), cachedBundle.getLong(LONG_KEY));
assertArrayEquals(originalBundle.getLongArray(LONG_ARRAY_KEY), cachedBundle.getLongArray(LONG_ARRAY_KEY));
代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher
int selectedTabIndex = savedInstanceState.getInt(SELECTED_TAB_INDEX_EXTRA);
selectedTab = selectedTabIndex != -1 ? tabs.get(selectedTabIndex) : null;
padding = savedInstanceState.getIntArray(PADDING_EXTRA);
applyPaddingToTabs = savedInstanceState.getBoolean(APPLY_PADDING_TO_TABS_EXTRA);
tabIconId = savedInstanceState.getInt(TAB_ICON_ID_EXTRA);
代码示例来源:origin: Neamar/KISS
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mTitleResId = getArguments().getInt(KEY_TITLE_ID);
mColumns = getArguments().getInt(KEY_COLUMNS);
mSize = getArguments().getInt(KEY_SIZE);
}
if (savedInstanceState != null) {
mColors = savedInstanceState.getIntArray(KEY_COLORS);
mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR);
mColorContentDescriptions = savedInstanceState.getStringArray(
KEY_COLOR_CONTENT_DESCRIPTIONS);
}
}
代码示例来源:origin: stackoverflow.com
public class ImageSwitch1 extends Activity{
public void onCreate...(redacted)
Bundle b=this.getIntent().getExtras();
int[] mThumb = b.getIntArray("mThumbSent");
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState)
{
super.onViewStateRestored(savedInstanceState);
if (savedInstanceState != null) {
scrollPosition = savedInstanceState.getIntArray(TAG_SCROLL_POSITION);
if (scrollPosition != null && scrollPosition.length == 2)
pieceMapScrollView.scrollTo(scrollPosition[0], scrollPosition[1]);
}
}
代码示例来源:origin: gkasten/drrickorang
private BufferCallbackTimes(Parcel source) {
Bundle in = source.readBundle(getClass().getClassLoader());
mTimeStamps = in.getIntArray("mTimeStamps");
mCallbackDurations = in.getShortArray("mCallbackDurations");
mExpectedBufferPeriod = in.getShort("mExpectedBufferPeriod");
mExceededCapacity = in.getBoolean("mExceededCapacity");
mIndex = in.getInt("mIndex");
}
内容来源于网络,如有侵权,请联系作者删除!