Unable to understand why parent was passed as an argument instead of MainActivity

I am not able to understand why parent was passed in the arguments of getLayoutInflater().inflate() method. What is the meaning of a ViewGroup and parent?

I also did not understand the use and meaning of setTag function in the concept where it was being explained that view holder will decrease cpu and memory usage.

Hey @kartiksinghal0198
To clarify your doubts, ViewGroup essentially refers to all the Layouts we have (LinearLayout, FrameLayout, RelativeLayout, etc.)

The special thing about ViewGroups is that unlike Views, they can contain more views inside them.

Parent is nothing but a variable name that is of the type ViewGroup.

the iflate() method takes in 3 parameters, 1st if the layout which we need to inflate.
The second parameter is an already existing viewgroup or layout inside which this inflated layout will go to.
The third parameter is a boolean, which if set to true, will immediately add the inflated layout to our viewgroup.

A lot of android framework APIs handle adding the inflated layout to viewholder automatically, so we pass false in here.
Some of the examples of these APIs are Adapters and Fragments.

Best!