Skip to content

Instantly share code, notes, and snippets.

@Frank1234
Last active February 16, 2020 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Frank1234/b1d08ee49f81ace35f95954919848c20 to your computer and use it in GitHub Desktop.
Save Frank1234/b1d08ee49f81ace35f95954919848c20 to your computer and use it in GitHub Desktop.
Example Fragment for ViewBindingHolder
class ExampleFragment : Fragment(), ViewBindingHolder<FragmentExampleBinding> by ViewBindingHolderImpl() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = initBinding(FragmentExampleBinding.inflate(layoutInflater), this) {
// do your onCreateView logic here, where 'this' is the binding object.
textTitle.text = "Clean ViewBinding and Lifecycle handling"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment