Junior — Middle
Where in the code is the interface binding to the Fragment component performed?
sobes.tech AI
Answer from AI
Binding the interface to a Fragment component usually occurs in the onCreateView method. In this method, the root View of the fragment is created and returned, which is loaded from an XML layout using LayoutInflater. For example:
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_example, container, false)
}
Here, R.layout.fragment_example is an XML file describing the interface, which is linked to this fragment.