Home > other >  Error inflating class fragment when changing my data class
Error inflating class fragment when changing my data class

Time:12-19

My app is working fine when using the data class that i'm currently using from an online exercise: Plugin for converting the data class

CodePudding user response:

Your new MarsProperty class does not implement the Parcelable interface and does not have the @Parcelize annotation. I guess it can be an issue as the Navigation Component does not support passing such classes as destination arguments - they have to meet some requirements.

CodePudding user response:

Just implement Parcelable and add @Parcelize annotation.

@Parcelize
data class MarsProperty: Parcelable (
    val Name: String,
    val imagesURL: String,
    val street: String,
    val city_name: String,
    val phone: String
)

Your data class must implement Serializable or Parcelable to pass arguments in Navigation Component.

  • Related