Created
February 1, 2021 18:39
-
-
Save abhishekBansal/d5e2a2e1d1b6b9f1af155816b27a6991 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class DemoFragment : Fragment() { | |
| // declare binding | |
| private var binding: FragmentDemoBinding? = null | |
| override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | |
| savedInstanceState: Bundle?): View? { | |
| // inflate and return view | |
| binding = FragmentDemoBinding.inflate(inflater, container, false) | |
| return binding?.root | |
| } | |
| override fun onDestroyView() { | |
| super.onDestroyView() | |
| // make it null to handle different view lifecycle in fragments | |
| binding = null | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment