Passing ArrayList

Kotlin Passing ListArray to another Activity using Serializable
DTO


data class Subdata(val name: String, val imgurl: String) : Serializable{}
MainListItemsActivity.kt

//Set ArryaList With Dto class
var bundle = Bundle()
bundle!!.putSerializable("data",subarraydata)

val intent = Intent(this@MainListItemsActivity, SubListItemsActivity::class.java)
intent.putExtra("bundle",bundle)
startActivity(intent)

SubListItemsActivity.kt

//Get ArrayList
if(intent !=null)
{
    val bundles:Bundle = intent.extras.get("bundle") as Bundle
    if(bundles!=null)
    {
        val adapterlists = bundles.getSerializable("data") as ArrayList<Subdata>
    }
}

Comments

Popular posts from this blog