i have 1 doubt , want clear points regarding activity holding multiple fragments.
i have 10 fragments attached 1 activity (homeactivity.java); activity contains 1 navigation drawer , tool bar multiple icons search, add, remove, button etc.
the structure following below,
user clicks item navigation drawer, loading fragments,
fragmentmanager.begintransaction().replace(r.id.fragment_container, fragmenttoload, tagfragment).addtobackstack(tagfragment).commit();
fragmenttoload -> fragment name, tagfragment -> tag particular fragment.
i changing title name, toolbar based according fragments in homeactivity itself.
my navigation drawer items having 1 fragment , replaced in fragment_container 1 thing there, these fragment having inner sub-fragments too.
in start, said there 10 fragments, 10 fragments navigation drawer items. there many inner framgents.
now, inner fragment's click listeners , other activities maintaning in homeactivity.java using interfaces(listeners).
so, times getting warning "there lots of work going on main thread".
i understand there lots of activities going on homeactivity.java.
please tell me architecture wrong or there solution.
i wouldn't architecture wrong. instead, using single central activity handle many fragments, making maintaining , debugging activity difficult yourself.
as far warning message concerned, depends upon number of frames skipped (something printed before 'there lots of work going on main thread' in log). believe if number ~ 100 shouldn't matter of grave concern. kindly go through this answer complete explanation! hope helps.
Comments
Post a Comment