I want a summary model to be the sticky header so I added the following check.
override fun isStickyHeader(position: Int): Boolean {
val model = adapter.getModelAtPosition(position)
return (model is RoleHeader) || (model is StaffHeader)
}
I noticed that after the state of this view changed, under some circumstances the view would crash. Through debugging I found that the position that passed into this function was larger than the count of the models
So i used try/catch to fix it but that broke my view:
override fun isStickyHeader(position: Int): Boolean {
return try {
val model = adapter.getModelAtPosition(position)
(model is RoleHeader) || (model is StaffHeader)
} catch (e: Exception) {
false
}
}
I wish someone could fix that?