0

I need to pass it from recyclerview

I tried:

            val extras = Bundle()
            extras.putString("userNickname", meme.nickname)
            extras.putParcelableArray("memes", ArrayList(memes))

            val i = Intent(context, UserMemes::class.java)
            i.putExtras(extras)
            context.startActivity(i)

based on this answer: Pass a mutableList from activity A to activity B in Kotlin.

and get the error Type mismatch: inferred type is Memes! but Parcelable! was expected on ArrayList(memes)

I also need to know how to retrieve it on activity B

Thanks in advance!

  • add your `UserMemes` activity code. – Rahul sharma Mar 05 '20 at 12:57
  • There is only val userNickname = intent.getStringExtra("userNickname") inside onCreate so far –  Mar 05 '20 at 13:01
  • Kindly refer the link : https://stackoverflow.com/a/14333555/6903609. Make the Memes class implements Serializable – Logo Mar 05 '20 at 13:02
  • bundle.putSerializable("memesss", memes) gives Type mismatch: inferred type is MutableList but Serializable? was expected on memes –  Mar 05 '20 at 13:08
  • Please see [this](https://developer.android.com/training/basics/firstapp/starting-activity) to learn about starting an Activity, your intent is not built correctly. – mightyWOZ Mar 05 '20 at 13:49
  • @mightyWOZ I did it many times this way, just without i.putParcelableArrayListExtra("memes", ArrayList(memes)) which I changed in the question now by putting it into extras but I still have same error –  Mar 05 '20 at 13:56

0 Answers0