private val mAdapter = MyListAdapter() // 1️⃣ | |
// OR private var mAdapter: MyListAdapter? = null 2️⃣ | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
// OR Initialize MyListAdapter everytime when View is created 2️⃣ | |
// mAdapter = MyListAdapter(...) | |
binding.recyclerView.adapter = mAdapter | |
} | |
override fun onDestroyView() { | |
super.onDestroyView() | |
binding.recyclerView.adapter = null // 1️⃣ | |
// OR mAdapter = null 2️⃣ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment