Fixing InflateException occurring while inflating the fragment_a. It should be R.id.fragment_a instead of R.layout.fragment_a.

layout_activity_a is inflated (without the fragment) in the ActivityA class. The fragment is added dynamically in the method addFragment.

Note: In the ActivityA, activity_a is not inflated, instead we inflate layout_activity_a.xml.