Ali El-Sayed
Ali El-Sayed

Reputation: 99

Inflating Fragment View using View Binding with tow different ways

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

Answers (0)

Related Questions