Now I have my own blog.
Declare your data class like this
data class Albums(var folderNames: String, var imagePath: String, var imgCount: Int, var isVideo: Boolean) : Serializable
This is how you pass serialized data from one activity to another in kotlin
intent.putExtra("image_url_data", imagesList as Serializable) startActivity(intent)
// imagesList variable is type ArrayList<Albums>
Now you want to receive this data class object in second activity and want to deserialize it. This is how you will do this.
var listOfImages = intent.extras.get("image_url_data") as ArrayList<Albums>
A new Blog Developine
Check out this Gallery Application written in Kotlin on playstore. soon I will open source it. stay tuned!
Gallery Android Application on Google play store written in kotlin programming language.
Back to topic :) I recommend you to use parcelable instead of serializable.
Keywords : Kotlin, Serialization, DeSerialization, data class, arraylist, custom object, activity, android example, tutorial, Gallery application android.
No comments:
Post a Comment