Skip to Content
Creating dynamic UIs with Android fragments: create engaging apps with fragments to provide a rich user interface that dynamically adapts to the individual characteristics of your customers' tablets and smartphones

Creating dynamic UIs with Android fragments: create engaging apps with fragments to provide a rich user interface that dynamically adapts to the individual characteristics of your customers' tablets and smartphones

Wilson, Jim, author

Annotation Create engaging apps with fragments to provide a rich user interface that dynamically adapts to the individual characteristics of your customers' tablets and smartphonesAbout This Book From an eminent author comes a book that will help you create engaging apps that dynamically adapt to individual device characteristics The only book that includes the latest fragment-oriented features and their role in Material design This book provides code-intensive discussions and detailed examples that help you understand better and learn faster.Who This Book Is ForThis book is for developers with a basic understanding of Android programming who would like to improve the appearance and usability of their applications by creating a more interactive user experience and dynamically adaptive UIs; providing better support for tablets and smartphones in a single app; and reducing the complexity of managing app UIs.What You Will Learn Learn the role and capabilities of fragments Use Android Studio's fragment-oriented features Create an app UI that works effectively on smartphones and tablets Manage the creation and life cycle of fragments Dynamically manage fragments using the FragmentTransaction class Learn the application design for communicating between fragments Leverage fragments when implementing applications that take advantage of the latest features of Material DesignIn DetailToday's users expect mobile apps to be dynamic and highly interactive, with rich navigation features. These same apps must look fantastic whether running on a medium-resolution smartphone or high-resolution tablet. Fragments provide the toolset we need to meet these user expectations by enabling us to build our applications out of adaptable components that take advantage of the rich capabilities of each individual device and automatically adapt to their differences.This book looks at the impact fragments have on Android UI design and their role in both simplifying many common UI challenges and in providing best practices for incorporating rich UI behaviors. We look closely at the roll of fragment transactions and how to work with the Android back stack. Leveraging this understanding, we explore several specialized fragment-related classes such as ListFragment and DialogFragment. We then go on to discuss how to implement rich navigation features such as swipe-based screen browsing, and the role of fragments when developing applications that take advantage of the latest aspects of Material Design.You will learn everything you need to provide dynamic, multi-screen UIs within a single activity, and the rich UI features demanded by today's mobile users.Style and approachA fast-paced learning guide that gives a hands-on, code-intensive approach with a focus on real-world applications

eBook, Electronic resource, Book. English. Electronic books.
Second edition.
Published Birmingham, UK : Packt Publishing 2016
Rate this

This resource is available electronically from the following locations


Statement of responsibility: Jim Wilson
ISBN: 1785882767, 9781785882760
Note: Includes index.
Note: Description based on online resource; title from cover page (Safari, viewed April 5, 2016).
Note: Print version record.
Physical Description: 1 online resource : illustrations.
Series: Community experience distilled
Subject: COMPUTERS User Interfaces.; Application software Development.; Android (Electronic resource); User interfaces (Computer systems)
Alternative Title: Creating dynamic user interfaces with Android fragments
Series Title: Community experience distilled.
Local note: eBooks on EBSCOhost EBSCO eBooks for FE Collection (UK)


  1. Cover; Copyright; Credits; About the Author; About the Reviewers;; Table of Contents; Preface; Chapter 1: Fragments and UI Modularization; The need for a new approach to UI creation; The broad platform support of fragments; How fragments simplify common Android tasks; The relationship between fragments and activities; Making the shift to fragments; The old thinking
  2. activity-oriented; Defining the activity appearance; Displaying the activity UI; The new thinking: fragment-oriented; Creating the fragment layout resources; Creating the Fragment class
  3. Converting an activity to use fragmentsSummary
  4. Chapter 2: Fragments and UI Flexibility
  5. Creating UI flexibility
  6. Dynamic fragment layout selection
  7. Adding an alternate layout resource
  8. Managing fragment layout by screen size
  9. Eliminating redundant layout descriptions
  10. Designing fragments for flexibility
  11. Avoiding tight coupling
  12. Abstracting fragment relationships
  13. Encapsulating fragment operations
  14. Creating a loosely connected relationship between fragments
  15. Fragments protect against the unexpected
  16. Creating the book description activity
  17. Adding functionality to the book description activity
  18. Making the MainActivity class adaptiveSummary
  19. Chapter 3: Fragment Life Cycle and Specialization
  20. Understanding the fragment life cycle
  21. Understanding fragment setup and display
  22. Avoiding method name confusion
  23. Understanding fragment hide and teardown
  24. Maximizing the available resources
  25. Managing a fragment state
  26. Special-purpose fragment classes
  27. ListFragment
  28. Associating data with the list
  29. Separating data from the display
  30. DialogFragment
  31. Styles
  32. Layout
  33. Displaying DialogFragment
  34. Event handling in DialogFragment
  35. The Dialog identity
  36. Summary
  37. Chapter 4: Working with Fragment Transactions
  38. Intentional screen managementDynamically managing fragments
  39. Deferred execution of transaction changes
  40. Adding and removing fragments
  41. Supporting the back button
  42. Creating an adaptive application layout
  43. Updating the layout to support dynamic fragments
  44. Adapting to device differences
  45. Dynamically loading a fragment at startup
  46. Transitioning between fragments
  47. Eliminating redundant handling
  48. Creating the fragment on the fly
  49. Managing asynchronous creation
  50. Putting it all together
  51. Summary
  52. Chapter 5: Creating Rich Navigation
  53. A brave new world
  54. Making navigation fun with swipe
  55. Implementing swipe navigationAdding swipe navigation with Android Studio
  56. Managing the swipe UI behavior
  57. Putting the swipe UI into place
  58. Providing direct navigation to screens
  59. Don't get trapped in the past
  60. Direct navigation for a small number of screens
  61. Direct navigation for four or more screens
  62. Creating a navigation drawer activity with Android Studio
  63. The activity and application screen fragment
  64. The navigation drawer fragment
  65. Summary
  66. Chapter 6: Fragments and Material Design
  67. Creating a rich user experience
  68. Material design
  69. Principles of material design
  70. The role of motion