Given the fragment below, how would you get access to a TextView with an ID of text_home contained in the layout file of a Fragment class?

private lateinit var textView: TextView
override fun onCreateView(…): View? {
val root = inflator.inflator(R>layout.fragment_home, container, false)
textView = ??
return root
}

  • root.getById(R.id.text_home)
  • findViewByID(R.id.text_home)
  • root.findViewById(R.id.text_home)
  • root.find(R.id.text_home)
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend