0

Basically, I want to convert the ArrayMap of RemoteMessage.data into a Bundle. In this question (Convert Map to Bundle in android), an answer says writeToParcel should be useful as Parcel is a parent class of Bundle.

But when I looked it up, Bundle extends BaseBundle, which extends Object. What do they mean parent? Can I use writeToParcel to write the data of an ArrayMap to a Bundle?

https://developer.android.com/reference/android/os/Parcel.html https://developer.android.com/reference/android/os/Bundle.html https://developer.android.com/reference/android/os/BaseBundle.html

Damn Vegetables
  • 11,484
  • 13
  • 80
  • 135
  • No, the type of `data` is `ArrayMap`. I was trying to link the documentation page to that word, but my damn cheap Internet was disconnected and just got back. – Damn Vegetables Nov 10 '17 at 07:04
  • Try my answer https://stackoverflow.com/questions/43909061/passing-object-array-list-between-fragments-in-android-development/43910817#43910817. If this didn't work then I think you have to go with writeToParcel – karthik vishnu kumar Nov 10 '17 at 07:07
  • It is not ArrayList but `ArrayMap` and I was trying to pass a bundle to `writeToParcel`, which did not work. I experimented a little, and the following code seemed to compile (not tested yet). var p = Parcel.obtain(); remoteMessage.writeToParcel(p, 0); var b = Bundle(); b.putParcelable("data", b) – Damn Vegetables Nov 10 '17 at 07:13

0 Answers0