Skip to content Skip to sidebar Skip to footer

Onresume Called Multiple Times Inside Fragment

I have InnerFragment containing RecyclerView, inside MainFragment which is added to ViewPager. When MainFragment gets created while swiping OnResume is called multiple times 1st

Solution 1:

when adding fragment, use replace() instead of add()

before

getChildFragmentManager().beginTransaction().add(R.id.framelayoutID, InnerFragment.newInstance()).commit();

after

getChildFragmentManager().beginTransaction().replace(R.id.framelayoutID, InnerFragment.newInstance()).commit();

Post a Comment for "Onresume Called Multiple Times Inside Fragment"