This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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