I am sending a list data from Activity "A" to Activity "B" using intent as follows.
private var items : Lists<Items>
context.startActivity(
Intent(context, B::class.java).apply {
putExtra("itemList", items as ArrayList)
}
)
Inside Activity "B"
val itemList = intent?.extras?.getSerializable("itemList") as? ArrayList<Tweet>
// trying to edit the list
items.forEachIndexed { index, t ->
run {
if (t.id == tweet.id) {
items[index].name = "hello"
}
}
}
However, when I try to edit the list items, it is not editing the list. Is it because when I send the data using intent is it sending a copy of my original data? Any help would be appreciated.
0 Replies