You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.
abstract class CollectionFragment {
protected val emptyView: View by bindView(R.id.empty_view)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
... some base layout ...
}
}
`
then we inherit, and we want to access some view:
`
class NewsFragment : CollectionFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val rootView: View? = super.onCreateView(inflater, container, savedInstanceState)
emptyDataButton.visibility = View.GONE // hide empty data button
return rootView
}
}
`
But we get NPE while accessing this 'emptyView':
Caused by: kotlin.KotlinNullPointerException
at butterknife.ButterKnifeKt$viewFinder$5.invoke(ButterKnife.kt:73)
at butterknife.ButterKnifeKt$viewFinder$5.invoke(ButterKnife.kt)
at butterknife.ButterKnifeKt$required$1.invoke(ButterKnife.kt:82)
at butterknife.ButterKnifeKt$required$1.invoke(ButterKnife.kt)
at butterknife.Lazy.getValue(ButterKnife.kt:103)
at CollectionFragment.getEmptyDataButton(CollectionFragment.kt:0)
at NewsFragment.onCreateView(NewsFragment.kt:50)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2189)
When we rollback to classic ButterKnife:
@BindView(R.id.btn_empty_data) lateinit var emptyDataButton: Button
everything is OK
The text was updated successfully, but these errors were encountered:
Imagine, we have an abstract base view-class:
`
`
then we inherit, and we want to access some view:
`
`
But we get NPE while accessing this 'emptyView':
When we rollback to classic ButterKnife:
@BindView(R.id.btn_empty_data) lateinit var emptyDataButton: Button
everything is OK
The text was updated successfully, but these errors were encountered: