Reputation: 99
Typically, when inflating Fragments, I can use two different methods,, but I want to know the difference between them.
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View {
binding = FragmentCartBinding.inflate(inflater, container, false)
return binding.root
}
private val binding by lazy { FragmentCartBinding.inflate(layoutInflater) }
Both are working correctly until now, and I can't see any difference.
Upvotes: 0
Views: 18