Skip to content

Instantly share code, notes, and snippets.

@andersu
Last active September 11, 2020 11:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersu/203f69f2abdb29b6ad7f3447ac2ba31b to your computer and use it in GitHub Desktop.
Save andersu/203f69f2abdb29b6ad7f3447ac2ba31b to your computer and use it in GitHub Desktop.
Google View Binding example code
private var _binding: ResultProfileBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = ResultProfileBinding.inflate(inflater, container, false)
val view = binding.root
return view
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment