java - Replacing a fragment with another fragment inside activity group -


i have fragment inside group activity , want replace fragment:

fragmenttransaction ft = getactivity().getfragmentmanager().begintransaction(); sectiondescriptionfragment bdf = new sectiondescriptionfragment(); ft.replace(r.id.book_description_fragment, bdf); ft.settransition(fragmenttransaction.transit_fragment_open); ft.addtobackstack(null); ft.commit(); 

it works fine when done seperate project without using activity group, every thing works fine in log cat control goes inside getview(), no view visible, not exception arises, want book detail fragment replaced section detail fragment.

xml of book detail fragment has id book_description_fragment , xml section description fragment has id section_description_fragment.

the above code in onclick method of item, want when user taps on item in horizontal scroll view, fragment changes.

fragments hard coded in xml, cannot replaced. if need replace fragment another, should have added them dynamically, first of all.

// create new fragment , transaction fragment newfragment = new examplefragment(); fragmenttransaction transaction = getfragmentmanager().begintransaction();  // replace whatever in fragment_container view fragment, // , add transaction stack if needed transaction.replace(r.id.fragment_container, newfragment); transaction.addtobackstack(null);  // commit transaction transaction.commit(); 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -