Building Flexible Android Apps with the Fragments API with Java
Offered By: LinkedIn Learning
Course Description
Overview
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.
Syllabus
Introduction
- Welcome
- What you should know
- Using the exercise files
- Configure Android Studio for this course
- The fragmented market of Android devices
- Adapting to screen sizes and densities
- Understanding fragments
- Create an app with a fragment
- Create a fragment class and layout
- Display a fragment with XML
- Explore the FragmentTransaction class
- Add a fragment with Java
- Remove a fragment with Java
- The lifecycle of a fragment
- Trace lifecycle events with LogCat
- Pass arguments to a fragment
- Manage arguments with a factory method
- Measure screen with Java
- Detect screen with resource selectors
- Choose layout at runtime
- Java interfaces and callback methods
- Define interface with callback methods
- Send a message from a fragment
- Send parcelable objects to a fragment
- Display data lists in fragments
- Wrap an alert dialog in a fragment
- Display a custom dialog
- Pass arguments to the dialog
- Use callback methods in a dialog
- Create a fragment for ViewPager
- Create a ViewPager adapter
- Manage back button with ViewPager
- Manage shared preferences with fragments
- Next steps
Taught by
David Gassner
Related Courses
Algorithms, Part IPrinceton University via Coursera Introduction à la programmation orientée objet (en Java)
École Polytechnique Fédérale de Lausanne via Coursera MongoDB for Java Developers
MongoDB University Initiation à la programmation (en Java)
École Polytechnique Fédérale de Lausanne via Coursera Intro to Java Programming
San Jose State University via Udacity