So I have defined a simple Integer Array in Kotlin (in activity 1)
var arr = intArrayOf(1, 2, 3, 4, 5)
The following Toast allows me to see the values in the array (in activity 1) as [1,2,3,4,5]
Toast.makeText(getApplicationContext(), “My Array = ” + arr.contentToString(), Toast.LENGTH_LONG).show();
I then pass the array to a second activity using
val intent = Intent(this, SecondActivity::class.java)
intent.putExtra("key4", arr)
startActivity(intent)
In activity 2 I use the following to get the array
val newArr = intent ( “key4” )
Here I did try
val newArr = intent .getSerializableExtra( “key4” )
But Android Studio Koala struck-out the .getSerializableExtra
Now I am trying to see the values using
Toast.makeText(getApplicationContext(), “My Array now = ” + newArr.contentToString(), Toast.LENGTH_LONG).show();
But my output is
[!@c1b80a4] instead of [1,2,3,4,5]
Could someone please explain what I have domw wrong ?
Thank you
I have Googled the issue but found no solution. I do remember sometime last year watching an online tutorial about Javaarraysand vaguely remember that such anoutput means that there is something missing in defining the array (I think) but I cant remember where I read that.