本文整理汇总了Java中android.os.Bundle.getLongArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getLongArray方法的具体用法?Java Bundle.getLongArray怎么用?Java Bundle.getLongArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.getLongArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResult
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected Bundle onResult(int which) {
Bundle b = super.onResult(which);
int color = (int) b.getLong(SELECTED_SINGLE_ID);
if (color == PICKER){
b.putInt(COLOR, mCustomColor);
} else {
b.putInt(COLOR, color);
}
long[] ids = b.getLongArray(SELECTED_IDS);
if (ids != null) {
int[] colors = new int[ids.length];
for (int i = 0; i < ids.length; i++) {
if (ids[i] == PICKER) {
colors[i] = mCustomColor;
} else {
colors[i] = (int) ids[i];
}
}
b.putIntArray(COLORS, colors);
}
return b;
}
示例2: restoreSelectedMessages
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Restore selected messages from a {@link Bundle}.
*/
private void restoreSelectedMessages(Bundle savedInstanceState) {
long[] selected = savedInstanceState.getLongArray(STATE_SELECTED_MESSAGES);
if (selected != null) {
for (long id : selected) {
this.selected.add(id);
}
}
}
示例3: restoreState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(@Nullable Parcelable state, ClassLoader loader) {
if (state != null) {
Bundle bundle = (Bundle) state;
bundle.setClassLoader(loader);
long[] fss = bundle.getLongArray("states");
mSavedStates.clear();
mFragments.clear();
if (fss != null) {
for (long fs : fss) {
mSavedStates.put(fs, (Fragment.SavedState) bundle.getParcelable(Long.toString(fs)));
}
}
Iterable<String> keys = bundle.keySet();
for (String key : keys) {
if (key.startsWith("f")) {
Fragment f = mFragmentManager.getFragment(bundle, key);
if (f != null) {
f.setMenuVisibility(false);
mFragments.put(Long.parseLong(key.substring(1)), f);
} else {
Log.w(TAG, "Bad fragment at key " + key);
}
}
}
}
}
示例4: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Bundle args = getArguments();
if (args != null) {
long[] bookmarkIds = args.getLongArray(EXTRA_BOOKMARK_IDS);
if (bookmarkIds != null) {
mTagBookmarkPresenter.setBookmarksMode(bookmarkIds);
}
}
}
示例5: restoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
/**
* This method should be called from your {@link AppCompatActivity} or
* {@link android.support.v4.app.Fragment Fragment} to allow the controller to restore any
* instance state.
*
* @param savedInstanceState - The state passed to your Activity or Fragment.
*/
public void restoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
long[] checkedIds = savedInstanceState.getLongArray(getStateKey());
if (checkedIds != null && checkedIds.length > 0) {
HashSet<Long> idsToCheckOnRestore = new HashSet<Long>();
for (long id : checkedIds) {
idsToCheckOnRestore.add(id);
}
tryRestoreInstanceState(idsToCheckOnRestore);
}
}
}
示例6: restoreIds
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Restore selected items.
* Saved with {@link Selection#saveIds(android.os.Bundle)}.
*/
public void restoreIds(Bundle bundle) {
mSelectedIds.clear();
if (bundle != null && bundle.containsKey(SAVED_BUNDLE_KEY)) {
long[] ids = bundle.getLongArray(SAVED_BUNDLE_KEY);
if (ids != null) {
for (long id : ids) {
mSelectedIds.add(id);
}
}
}
}
示例7: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
public void onRestoreInstanceState(Bundle bundle) {
String[] keys = bundle.getStringArray("channel_ids_keys");
long[] values = bundle.getLongArray("channel_ids_values");
if (keys != null && values != null && keys.length == values.length) {
for (int i = keys.length - 1; i >= 0; --i) {
channelIds.put(keys[i], values[i]);
nextChannelId = Math.max(nextChannelId, values[i] + 1);
}
}
updateChannelList();
}
示例8: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_move_albums);
unbinder = ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
intentFilter.addDataScheme("file");
Bundle bundle = getIntent().getExtras();
sourceId = bundle.getLong("sourceId", 0);
ids.clear();
for (long item : bundle.getLongArray("ids")) {
ids.add(item);
}
whatFragment = bundle.getInt("what", FragmentType.ALBUM_PHOTOS.ordinal());
if (whatFragment == FragmentType.ALBUM_PHOTOS.ordinal()) {
setTitle(getText(R.string.title_activity_move_albums));
}
else {
setTitle(getText(R.string.title_activity_move_faces));
}
adapter = new MoveAdapter(this, cols);
adapter.addHeader(new View(this));
gridLayoutManager = new GridLayoutManager(this, cols);
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.setAdapter(adapter);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return adapter.getSpanSize(position);
}
});
}
示例9: getLongArray
import android.os.Bundle; //导入方法依赖的package包/类
public long[] getLongArray(Bundle state, String key) {
return state.getLongArray(key + baseKey);
}
示例10: getLongArray
import android.os.Bundle; //导入方法依赖的package包/类
public long[] getLongArray(Bundle state, String key) {
return state.getLongArray(key + mBaseKey);
}