Closed vellrya closed 3 years ago
Hi Haven't got this exception in any of my apps or tests.
The fact that the activity is using DataBinding and ViewBinding should not make a difference since you supply the layout the view holder should use and it is inflated inside the library.
Does the adapter hold multiple types of data or a single type?
By the way, if you wish to use DataBinding in view holder layout as well, there is support for that, check the sample project.
DialogsActivity code:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityDialogsBinding.inflate(layoutInflater)
setContentView(binding.root)
... (1)
val oneAdapter = OneAdapter(binding.dialogsRV)
.attachItemModule(DialogModule())
... (2)
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
binding.dialogsRV.layoutManager = layoutManager
...
dialogViewModel.allDialogs.observe(this) { dialogs ->
oneAdapter.setItems(dialogs)
}
}
I will try to swap (1) and (2) code fragment, probably this is the reason of crash)
the layout manager should be attached to the RecyclerView before the adapter creation. tell me if it is still happening after the change
Hello!
Sometimes (<1%) there is an exceptiom in onCreate with this stacktrace:
Code DialogsActivity.kt, line 50:
DialogsActivity has DataBinding and ViewBinding, probably. there is some conflict between internal oneAdapter binding?