本文整理了Java中android.os.Bundle.getParcelableArrayList()
方法的一些代码示例,展示了Bundle.getParcelableArrayList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getParcelableArrayList()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getParcelableArrayList
暂无
代码示例来源:origin: pockethub/PocketHub
/**
* Get selected labels from result bundle
*
* @param arguments
* @return selected labels
*/
@SuppressWarnings("unchecked")
public static ArrayList<Label> getSelected(Bundle arguments) {
return arguments.getParcelableArrayList(ARG_SELECTED);
}
代码示例来源:origin: commonsguy/cw-omnibus
void onRestoreInstanceState(Bundle state) {
buffers=state.getParcelableArrayList(STATE_BUFFERS);
}
代码示例来源:origin: sockeqwe/fragmentargs
@Override public <T extends List<? extends Parcelable>> T get(String key, Bundle bundle) {
return (T) bundle.getParcelableArrayList(key);
}
}
代码示例来源:origin: stackoverflow.com
Bundle extras = getIntent().getExtras();
ArrayList<ObjectName> arraylist = extras.getParcelableArrayList("arraylist");
ObjectName object1 = arrayList[0];
代码示例来源:origin: zhihu/Matisse
public void onCreate(Bundle bundle) {
if (bundle == null) {
mItems = new LinkedHashSet<>();
} else {
List<Item> saved = bundle.getParcelableArrayList(STATE_SELECTION);
mItems = new LinkedHashSet<>(saved);
mCollectionType = bundle.getInt(STATE_COLLECTION_TYPE, COLLECTION_UNDEFINED);
}
}
代码示例来源:origin: pockethub/PocketHub
@SuppressWarnings("unchecked")
private ArrayList<GitReference> getChoices() {
return getArguments().getParcelableArrayList(ARG_CHOICES);
}
代码示例来源:origin: pockethub/PocketHub
@SuppressWarnings("unchecked")
private ArrayList<Label> getChoices() {
return getArguments().getParcelableArrayList(ARG_CHOICES);
}
代码示例来源:origin: pockethub/PocketHub
@SuppressWarnings("unchecked")
private ArrayList<User> getChoices() {
return getArguments().getParcelableArrayList(ARG_CHOICES);
}
代码示例来源:origin: facebook/facebook-android-sdk
/**
* Gets an array of photo values out of the object.
* @param key The key for the value.
* @return The photo values.
*/
@Nullable
public ArrayList<SharePhoto> getPhotoArrayList(final String key) {
final ArrayList<Parcelable> items = this.bundle.getParcelableArrayList(key);
if (items == null) {
return null;
}
final ArrayList<SharePhoto> list = new ArrayList<SharePhoto>();
for (Parcelable item : items) {
if (item instanceof SharePhoto) {
list.add((SharePhoto)item);
}
}
return list;
}
代码示例来源:origin: bluelinelabs/Conductor
void restoreInstanceState(@NonNull Bundle savedInstanceState) {
ArrayList<Bundle> entryBundles = savedInstanceState.getParcelableArrayList(KEY_ENTRIES);
if (entryBundles != null) {
Collections.reverse(entryBundles);
for (Bundle transactionBundle : entryBundles) {
backstack.push(new RouterTransaction(transactionBundle));
}
}
}
}
代码示例来源:origin: aurelhubert/ahbottomnavigation
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
currentItem = bundle.getInt("current_item");
notifications = bundle.getParcelableArrayList("notifications");
state = bundle.getParcelable("superState");
}
super.onRestoreInstanceState(state);
}
代码示例来源:origin: bluelinelabs/Conductor
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
StringSparseArrayParceler permissionParcel = savedInstanceState.getParcelable(KEY_PERMISSION_REQUEST_CODES);
permissionRequestMap = permissionParcel != null ? permissionParcel.getStringSparseArray() : new SparseArray<String>();
StringSparseArrayParceler activityParcel = savedInstanceState.getParcelable(KEY_ACTIVITY_REQUEST_CODES);
activityRequestMap = activityParcel != null ? activityParcel.getStringSparseArray() : new SparseArray<String>();
ArrayList<PendingPermissionRequest> pendingRequests = savedInstanceState.getParcelableArrayList(KEY_PENDING_PERMISSION_REQUESTS);
pendingPermissionRequests = pendingRequests != null ? pendingRequests : new ArrayList<PendingPermissionRequest>();
}
}
代码示例来源:origin: aa112901/remusic
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.recylerview, container, false);
if (getArguments() != null) {
songInfos = getArguments().getParcelableArrayList("searchMusic");
}
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new MusicAdapter(songInfos);
recyclerView.setAdapter(mAdapter);
recyclerView.setHasFixedSize(true);
recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST));
return view;
}
代码示例来源:origin: k9mail/k-9
public void onRestoreInstanceState(Bundle savedInstanceState) {
actionToPerformAfterWaiting = WaitingAction.valueOf(
savedInstanceState.getString(STATE_KEY_WAITING_FOR_ATTACHMENTS));
nextLoaderId = savedInstanceState.getInt(STATE_KEY_NEXT_LOADER_ID);
ArrayList<Attachment> attachmentList = savedInstanceState.getParcelableArrayList(STATE_KEY_ATTACHMENTS);
// noinspection ConstantConditions, we know this is set in onSaveInstanceState
for (Attachment attachment : attachmentList) {
attachments.put(attachment.uri, attachment);
attachmentMvpView.addAttachmentView(attachment);
if (attachment.state == LoadingState.URI_ONLY) {
initAttachmentInfoLoader(attachment);
} else if (attachment.state == LoadingState.METADATA) {
initAttachmentContentLoader(attachment);
}
}
}
代码示例来源:origin: aa112901/remusic
private void loadArtists() {
if (getArguments() != null) {
artistInfos = getArguments().getParcelableArrayList("searchArtist");
}
mAdapter = new ArtistAdapter(artistInfos);
recyclerView.setAdapter(mAdapter);
setItemDecoration();
}
代码示例来源:origin: aa112901/remusic
private void loadAlbums() {
if (mContext == null) {
return;
}
if (getArguments() != null) {
mAlbumList = getArguments().getParcelableArrayList("searchAlbum");
mAdapter = new AlbumAdapter(mAlbumList);
recyclerView.setAdapter(mAdapter);
setItemDecoration();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ArrayList<PermissionInfo> perms=
getArguments().getParcelableArrayList(ARG_PERMS);
if (perms!=null && perms.size()>0) {
Collections.sort(perms, new Comparator<PermissionInfo>() {
@Override
public int compare(PermissionInfo one, PermissionInfo two) {
return (one.name.compareTo(two.name));
}
});
setListAdapter(new PermissionAdapter(perms));
}
else {
setListAdapter(new PermissionAdapter(new ArrayList<PermissionInfo>()));
setEmptyText(getActivity().getString(R.string.msg_no_perms));
}
}
代码示例来源:origin: zhihu/Matisse
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!SelectionSpec.getInstance().hasInited) {
setResult(RESULT_CANCELED);
finish();
return;
}
Bundle bundle = getIntent().getBundleExtra(EXTRA_DEFAULT_BUNDLE);
List<Item> selected = bundle.getParcelableArrayList(SelectedItemCollection.STATE_SELECTION);
mAdapter.addAll(selected);
mAdapter.notifyDataSetChanged();
if (mSpec.countable) {
mCheckView.setCheckedNum(1);
} else {
mCheckView.setChecked(true);
}
mPreviousPos = 0;
updateSize(selected.get(0));
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testParcelableArrayListExtra() {
Intent intent = new Intent();
Parcelable parcel1 = new TestParcelable(22);
Parcelable parcel2 = new TestParcelable(23);
ArrayList<Parcelable> parcels = new ArrayList<>();
parcels.add(parcel1);
parcels.add(parcel2);
assertSame(intent, intent.putParcelableArrayListExtra("foo", parcels));
assertSame(parcels, intent.getParcelableArrayListExtra("foo"));
assertSame(parcel1, intent.getParcelableArrayListExtra("foo").get(0));
assertSame(parcel2, intent.getParcelableArrayListExtra("foo").get(1));
assertSame(parcels, intent.getExtras().getParcelableArrayList("foo"));
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!