I\'m having a really weird problem. I have a common fragment that is added in almost every activity of my app. This fragment shows a small version of the player bar. So it l
For future reference, I found that my issue lay in my fragment's onCreateView() method. I had the following:
private lateinit var containingView : View
// ......
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
containingView = inflater.inflate(R.layout.my_fragment_layout, container, false)
return view
}
.....which caused an error because while I was inflating the layout to containingView, I was actually returning view (which just happens to be a property of the fragment class of the correct type). The corrected code is this:
private lateinit var containingView : View
// ......
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
containingView = inflater.inflate(R.layout.my_fragment_layout, container, false)
return containingView
}