Parcelable 写序列化对象遇到IOException (name = [Lcom.example.gaeo.Model_responsable;)
Parcelable encountered IOException writing serializable object (name = [Lcom.example.gaeo.Model_responsable;)
我在尝试从适配器
调用 activity 时出现此异常
第一个 class :
class Model_responsable (val adressePrincipale: String,
val emailPrincipal: String,
val telephonePrincipal: String,
val siteWebPrincipal: String,
val nom: String,
val fonction: String,
val commentaires: Array<Model_commentaire>)
第二个class:
class Model_commentaire ( val contenu: String,
val importance: String)
我在适配器中的代码
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.nom?.text = responsables[position].nom
holder.fonction?.text = responsables[position].fonction
holder.telephone?.text = responsables[position].telephonePrincipal
holder.email?.text = responsables[position].emailPrincipal
holder.adresse?.text = responsables[position].adressePrincipale
if (10 >0 )
holder.commentaires?.visibility = View.VISIBLE
else
holder.commentaires?.visibility = View.GONE
// Mise en place de clicks
holder.commentaires?.setOnClickListener() {
var intent = Intent(it.context, Activity_commentaires::class.java)
startActivity(it.context, intent, null)
}
}
我的空白 activity 应该会弹出。相反,它出现了,消失了,我有这个错误
java.lang.RuntimeException: Parcelable 在写入可序列化对象时遇到 IOException (name = [Lcom.example.gaeo.Model_responsable;)
你完全正确,它与 Serializable 接口一起工作得很好。非常感谢
我在尝试从适配器
调用 activity 时出现此异常第一个 class :
class Model_responsable (val adressePrincipale: String,
val emailPrincipal: String,
val telephonePrincipal: String,
val siteWebPrincipal: String,
val nom: String,
val fonction: String,
val commentaires: Array<Model_commentaire>)
第二个class:
class Model_commentaire ( val contenu: String,
val importance: String)
我在适配器中的代码
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.nom?.text = responsables[position].nom
holder.fonction?.text = responsables[position].fonction
holder.telephone?.text = responsables[position].telephonePrincipal
holder.email?.text = responsables[position].emailPrincipal
holder.adresse?.text = responsables[position].adressePrincipale
if (10 >0 )
holder.commentaires?.visibility = View.VISIBLE
else
holder.commentaires?.visibility = View.GONE
// Mise en place de clicks
holder.commentaires?.setOnClickListener() {
var intent = Intent(it.context, Activity_commentaires::class.java)
startActivity(it.context, intent, null)
}
}
我的空白 activity 应该会弹出。相反,它出现了,消失了,我有这个错误
java.lang.RuntimeException: Parcelable 在写入可序列化对象时遇到 IOException (name = [Lcom.example.gaeo.Model_responsable;)
你完全正确,它与 Serializable 接口一起工作得很好。非常感谢