【发布时间】:2019-12-29 16:00:16
【问题描述】:
尝试从适配器调用活动时出现此异常
头等舱:
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 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)
}
}
我的空活动应该会弹出。相反,它出现了,消失了,我有这个错误
java.lang.RuntimeException: Parcelable遇到IOException写入可序列化对象(name = [Lcom.example.gaeo.Model_responsable;)
【问题讨论】:
-
不应该
Model_responsable实现Serializable接口吗?