Since this topic is fairly new, could someone tell me how to use this feature? I am trying to use it in a fragment.
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
...
Handler().postDelayed({
homePostAdapter!!.stateRestorationPolicy =
RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY
},500)
...
}
Doesn't seem to work like this. Happy to paste the complete fragment class.
For future reading, these links help: