Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Create layouts for various screen sizes with the Android Fragments API. Learn to add and remove fragments with Java and XML and use fragments to dynamically choose layouts.
One of the most common challenges Android developers face is the variation in screen sizes among the thousands of phones, tablets, and other devices that run Android. The Fragments API (introduced in Android 3.0) provides an elegant solution. With fragments, you can build flexible layouts that adapt to any screen size—and do so dynamically, at runtime. In this course, David Gassner shows how to define a layout, add fragments to activities with Java or XML, create alternative layouts for different screen sizes, and use resource folder names to detect and select the right layout. He also shows you how to communicate between activities and fragments with arguments and callback methods, and use fragments to manage dialogs and shared preferences.
One of the most common challenges Android developers face is the variation in screen sizes among the thousands of phones, tablets, and other devices that run Android. The Fragments API (introduced in Android 3.0) provides an elegant solution. With fragments, you can build flexible layouts that adapt to any screen size—and do so dynamically, at runtime. In this course, David Gassner shows how to define a layout, add fragments to activities with Java or XML, create alternative layouts for different screen sizes, and use resource folder names to detect and select the right layout. He also shows you how to communicate between activities and fragments with arguments and callback methods, and use fragments to manage dialogs and shared preferences.