I have one doubt and want to clear some points regarding the Activity holding multiple fragments.
I have 10 fragments attached with one Activity (HomeActivity.java); this activity contains one navigation drawer and tool bar with multiple icons like search, add, remove, back button etc.
The structure which I am following is below,
User clicks any item from navigation drawer, I am loading the fragments,
fragmentManager.beginTransaction().replace(R.id.fragment_container, fragmentToLoad, tagFragment).addToBackStack(tagFragment).commit();
fragmentToLoad -> fragment name, tagFragment -> tag to that particular fragment.
I am changing the title name, toolbar based according to the fragments in HomeActivity itself.
My navigation drawer items are having one fragment only and get replaced in fragment_container but one thing is also there, that these fragment are also having inner sub-fragments too.
In the start, I said that there are 10 fragments, those 10 fragments are navigation drawer items. There are many inner framgents.
Now, the inner fragment's click listeners and other activities I am maintaning in HomeActivity.java itself using interfaces(Listeners).
SO, some times I am getting warning "There is a lots of work going on main thread".
I understand that there is lots of activities going on HomeActivity.java.
Please tell me this architecture is wrong or is there any solution.