Skip navigation

Add a fragment with Java

Add a fragment with Java: Building Flexible Android Apps with the Fragments API
Add a fragment with Java: Building Flexible Android Apps with the Fragments API

To add a fragment to an activity programmatically, you need a placeholder in the activity's layout. The most common strategy is to place a FrameLayout object in the location where you want the fragment to appear, and then you can add or replace the fragment at runtime with a fragment transaction. A FrameLayout is a view group that's designed to only have one child object, so it makes the perfect placeholder.

Resume Transcript Auto-Scroll
Skill Level Intermediate
2h 26m
Duration
89,842
Views
Show More Show Less
Skills covered in this course
Developer Mobile Apps Android

Continue Assessment

You started this assessment previously and didn't complete it. You can pick up where you left off, or start over.

Start My Free Month

Start your free month on LinkedIn Learning, which now features 100% of Lynda.com courses. Develop in-demand skills with access to thousands of expert-led courses on business, tech and creative topics.

Start My Free Month