Container: the ViewGroup
the view will be inserted into. For example, if this is an adapter for a ListView
, it will the ListView
. If this is a Fragment
and your fragment container is FrameLayout
it will be that FrameLayout
.
This is useful for using the LayoutParams
of the container, because this might decide how the view you create will look like.
Boolean: This parameter is called attachToRoot
. If true, it will do an addView()
on the container after inflating, so your will be already in the container after calling this (and calling container.addView(view)
will crash then). In adapters and fragments you should leave this on false
, because the implementation of these will call addView()
for you.
Also here's the original documentation if I was unclear somewhere.