I would like to send a list from Activity A to Activity B. When I receive the data inside Activity B, I would like to make changes to the received list items. When I go back to Activity A, I would like to see the changes that I just made. So far, I have tried sending a list of data using intent but when I try to edit it the changes are not being made. Here's my code sample:
Activity A
private var items : Lists<Items>
context.startActivity(
Intent(context, B::class.java).apply {
putExtra("itemList", items as ArrayList)
}
)
Activity B
val itemList = intent?.extras?.getSerializable("itemList") as? ArrayList<Items>
// trying to edit the list
itemList.forEachIndexed { index, t ->
run {
if (t.id == tweet.id) {
items[index].name = "hello"
}
}
}