Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Creating Dynamic UI with Android Fragments

You're reading from   Creating Dynamic UI with Android Fragments Make your Android apps a superior, silky-smooth experience for the end-user with this comprehensive guide to creating a dynamic and multi-pane UI. Everything you need to know in one handy volume.

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781783283095
Length 122 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jim Wilson Jim Wilson
Author Profile Icon Jim Wilson
Jim Wilson
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Creating Dynamic UI with Android Fragments
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Fragments and UI Modularization 2. Fragments and UI Flexibility FREE CHAPTER 3. Fragment Lifecycle and Specialization 4. Working with Fragment Transactions 5. Creating Rich Navigation with Fragments Index

Index

A

  • abstract fragment
    • callback interface, defining / Defining the callback interface
  • ActionBar.OnNavigationListener interface / Managing fragment selection
  • ActionBar.TabListener interface / Managing tab selection
  • ActionBarCompat class
    • URL / Improving navigation with the ActionBar
  • activity
    • compatibility / Activities and backward compatibility
  • activity-oriented
    • activity appearance, defining / Defining the activity appearance
    • activity UI, displaying / Displaying the activity UI
  • activity appearance
    • defining / Defining the activity appearance
  • Activity class / The need for a new approach to UI creation, Converting the activity to use fragments, Avoiding method name confusion, Putting the swipe UI into place
  • Activity Lifecycle
    • URL / Understanding the fragment lifecycle
  • activity UI
    • displaying / Displaying the activity UI
  • adaptive application layout
    • creating / Creating an adaptive application layout
  • add method / Adding and removing fragments, Managing tab selection, Connecting the fragments to the tabs
  • addTab method / Connecting the fragments to the tabs
  • addToBackStack method / Supporting the back button, Creating the fragment on-the-fly
  • AlertDialog class / Wrapping an existing dialog in a fragment
  • AlertDialogFragment class / Wrapping an existing dialog in a fragment
  • android.app.Activity class / Displaying the activity UI
  • android.app.Fragment class / Wrapping the list in a fragment
  • android.support.v4.app.Fragment class / Wrapping the list in a fragment
  • Android developer documentation
    • URL / Creating the ListFragment derived class
  • Android Developers Blog post
    • URL / The broad platform support of fragments
  • Android documentation
    • URL / Resource screen size groups
  • Android Studio
    • about / Android Studio and swipe navigation, Android Studio and drop-down list navigation
  • Android Support Library
    • URL / The broad platform support of fragments
  • ArrayAdapter class / Creating the ListFragment derived class, Providing the navigation choices
  • assumptions
    • minimizing / Minimize assumptions
  • asynchronous creation
    • managing / Managing asynchronous creation
  • attach method / Managing tab selection
  • available height screen size qualifier / Resource screen size qualifiers
  • available width screen size qualifier / Resource screen size qualifiers

B

  • back button
    • supporting / Supporting the back button
  • backward
    • compatibility / Activities and backward compatibility
  • beginTransaction method / Dynamically managing fragments
  • BookDescFragment class / Providing the display fragment, Encapsulating fragment operations, Making the MainActivity class adaptive, Adding and removing fragments, Creating the fragment on-the-fly, Putting it all together
  • BookDescFragment instance / Making the MainActivity class adaptive, Adding and removing fragments, Managing asynchronous creation, Putting it all together
  • book description
    • creating / Creating the book description activity
  • BookFragment class / Managing the swipe fragments, Putting the swipe UI into place
  • BookFragment instance / Managing the swipe fragments
  • bookIndex variable / Managing asynchronous creation
  • BookListFragment class / Wrapping the list in a fragment, Providing the display fragment, Abstracting fragment relationships, Making the fragment self-contained, Fragment notification
  • BookPagerAdapter class / Managing the swipe fragments, Putting the swipe UI into place
  • BookPagerAdapter instance / Putting the swipe UI into place
  • bookTitlesAdapter method / Creating the ListFragment derived class
  • Bundle class / Managing asynchronous creation
  • Bundle instance / Putting it all together, Managing the swipe fragments

C

  • commit method / Deferred execution of transaction changes, Adding and removing fragments, Managing asynchronous creation
  • container / Wrapping the list in a fragment

D

  • dashboards
    • URL / Resource screen size groups
  • data
    • separating, from display / Separating data from display
  • density independent pixel (dp) / Resource screen size qualifiers
  • detach method / Managing tab selection
  • Dialog
    • identity / Dialog identity
    • behavior, accessing / Accessing Dialog related behavior
    • wrapping, in fragment / Wrapping an existing dialog in a fragment
  • Dialog class / Event handling
  • DialogFragment class / Fragments simplify common Android tasks
    • about / DialogFragment
    • Styles / Styles
    • layout / Layout
    • display / DialogFragment display
    • event handling / Event handling
  • DialogFragment instance / Styles, DialogFragment display
  • direct access
    • providing, with drop-down list navigation / Providing direct access with drop-down list navigation
  • dismiss method / Event handling
  • display fragment
    • providing / Providing the display fragment
  • display layout
    • encapsulating / Encapsulating the display layout
  • drop-down list navigation
    • direct access, providing with / Providing direct access with drop-down list navigation
    • about / Android Studio and drop-down list navigation

E

  • event handling / Event handling
  • example code
    • downloading / Defining the activity appearance
  • executePendingTransactions method / Deferred execution of transaction changes

F

  • file
    • creating, Android Studio used / Layout aliasing
  • fragment
    • list, wrapping / Wrapping the list in a fragment
    • notification / Fragment notification
    • operations, encapsulating / Encapsulating fragment operations
    • pieces, connecting loosely / Loosely connecting the pieces
    • loading, at startup / Dynamically loading a fragment at startup
    • transitioning between / Transitioning between fragments
  • fragment-oriented
    • fragment layout resources / Creating the fragment layout resources
    • fragment class, creating / Creating the Fragment class
    • activity, converting to use fragments / Converting the activity to use fragments
  • FragmentActivity class / Activities and backward compatibility
  • Fragment class / The broad platform support of fragments, Wrapping the list in a fragment, Avoiding method name confusion, Special purpose fragment classes, Adapting to device differences
  • fragment class
    • list, wrapping in fragment / Wrapping the list in a fragment
    • display fragment, providing / Providing the display fragment
  • fragment classes
    • ListFragment class / ListFragment
    • DialogFragment class / DialogFragment
  • fragment display / Understanding fragment setup and display
  • fragment element / Converting the activity to use fragments, Updating the layout to support dynamic fragments, Adapting to device differences, Dynamically loading a fragment at startup
  • fragment hide / Understanding fragment hide and teardown
  • fragment layout
    • alternate layout resource, adding / Adding an alternate layout resource
    • managing, by screen size / Managing fragment layout by screen size
    • redundancy, eliminating / Eliminating redundancy
  • fragment layout resources
    • defining, as reusable list / Defining the layout as a reusable list
    • assumptions, minimizing / Minimize assumptions
    • display layout, encapsulating / Encapsulating the display layout
  • fragment lifecycle
    • about / Understanding the fragment lifecycle
    • fragment setup / Understanding fragment setup and display
    • fragment display / Understanding fragment setup and display
    • fragment hide / Understanding fragment hide and teardown
    • fragment teardown / Understanding fragment hide and teardown
    • available resources, maximizing / Maximizing available resources
  • FragmentManager.findFragmentById method / Loosely connecting the pieces
  • FragmentManager class / Loosely connecting the pieces, Deferred execution of transaction changes, Managing the swipe fragments
  • FragmentManager instance / Loosely connecting the pieces, Making the MainActivity class adaptive, Dynamically managing fragments
  • fragment on-the-fly
    • creating / Creating the fragment on-the-fly
  • FragmentPagerAdapter class / Managing the swipe fragments
  • fragments
    • about / The broad platform support of fragments, Making the shift to fragments
    • disadvantages / The broad platform support of fragments
    • used, for simpifying Android tasks / Fragments simplify common Android tasks
    • and activities, relation between / The relationship between fragments and activities
    • designing, for flexibility / Design fragments for flexibility
    • tight coupling, avoiding / Avoiding tight coupling
    • abstraction / Abstracting fragment relationships
    • managing / Dynamically managing fragments
    • transaction changes, executing / Deferred execution of transaction changes
    • adding / Adding and removing fragments
    • removing / Adding and removing fragments
    • back button, supporting / Supporting the back button
    • connecting, to tabs / Connecting the fragments to the tabs
  • fragment selection
    • managing / Managing fragment selection
  • fragment setup / Understanding fragment setup and display
  • fragment state
    • managing / Managing a fragment state
  • FragmentStatePagerAdapter class / Managing the swipe fragments
    • URL / Managing the swipe fragments
  • fragment teardown / Understanding fragment hide and teardown
  • FragmentTransaction.replace method / Supporting the back button
  • FragmentTransaction class / Maximizing available resources, Dynamically managing fragments, Adding and removing fragments, Supporting the back button, Creating the fragment on-the-fly, A brave new world, Managing tab selection
  • FragmentTransaction instance / Deferred execution of transaction changes, Managing tab selection
  • fragment variable / Managing fragment selection

G

  • getActivity method / Fragment notification, Understanding fragment hide and teardown
  • getArguments method / Managing asynchronous creation
  • getCount method / Managing the swipe fragments
  • getFragmentManager method / Loosely connecting the pieces
  • getInt method / Managing asynchronous creation
  • getItem method / Managing the swipe fragments
  • getListView method / Associating data with the list
  • getPageTitle method / Managing the swipe fragments, Putting the swipe UI into place
  • getSupportFragmentManager method / Loosely connecting the pieces

I

  • id value / Defining the activity appearance, Defining the layout as a reusable list
  • if statement / Making the MainActivity class adaptive
  • inflate method / Wrapping the list in a fragment
  • inflater / Wrapping the list in a fragment
  • Intent instance / Making the MainActivity class adaptive, Transitioning between fragments, Managing asynchronous creation
  • isInLayout method / Adapting to device differences
  • item element / Layout aliasing

L

  • layout / Layout
    • updating, to support dynamic fragments / Updating the layout to support dynamic fragments
    • adapting, to device differences / Adapting to device differences
  • layout-land / Adding an alternate layout resource
  • layout aliasing
    • about / Layout aliasing
  • LayoutInflater class / Wrapping the list in a fragment, Avoiding method name confusion
  • LayoutInflater instance / Wrapping the list in a fragment
  • layout resource files
    • evolving / Evolving layout resource files
    • updating / Updating the layout resources
  • layout_gravity attribute / Putting the swipe UI into place
  • layout_height attribute / Minimize assumptions, Encapsulating the display layout, Converting the activity to use fragments
  • layout_weight attribute / Minimize assumptions, Encapsulating the display layout, Converting the activity to use fragments
  • layout_width attribute / Converting the activity to use fragments
  • LinearLayout element / Defining the activity appearance, Minimize assumptions, Converting the activity to use fragments, Adding an alternate layout resource
  • list
    • wrapping, in fragment / Wrapping the list in a fragment
    • data, associating with / Associating data with the list
  • ListAdapter instance / Associating data with the list
  • ListAdapter interface / Associating data with the list
  • ListFragment.setListAdapter method / Associating data with the list
  • ListFragment class / Fragments simplify common Android tasks, ListFragment
    • about / ListFragment
    • data, associating with list / Associating data with the list
    • data, separating from display / Separating data from display
  • ListFragment derived class
    • creating / Creating the ListFragment derived class
  • ListFragment instance / Separating data from display, Handling ListFragment item selection
  • ListFragment item selection
    • handling / Handling ListFragment item selection
  • ListView class / Associating data with the list
  • ListView instance / Providing the navigation choices

M

  • MainActivity class / Activities and backward compatibility, Creating the book description activity, Making the MainActivity class adaptive
    • about / Adding an alternate layout resource
    • making / Making the MainActivity class adaptive
  • mBookDescriptionTextView instance / Managing asynchronous creation
  • method name confusion
    • avoiding / Avoiding method name confusion
  • mIsDynamic field / Creating the fragment on-the-fly

N

  • name attribute / Converting the activity to use fragments, Layout aliasing, Separating data from display
  • navigation
    • improving, with ActionBar / Improving navigation with the ActionBar
    • choices, providing / Providing the navigation choices
  • newTab method / Connecting the fragments to the tabs

O

  • onActivityCreated callback method / Associating data with the list
  • onActivityCreated method / Understanding fragment setup and display, Creating the ListFragment derived class
  • onAttach callback method / Understanding fragment setup and display
  • onAttach method / Maximizing available resources, Managing tab selection
  • onCreateDialog method / Dialog identity, Wrapping an existing dialog in a fragment
  • onCreate method / Understanding fragment setup and display, Maximizing available resources, Managing a fragment state, Adapting to device differences, Dynamically loading a fragment at startup, Transitioning between fragments, Eliminating redundant handling, Creating the fragment on-the-fly, Managing tab selection, Connecting the fragments to the tabs, Providing the navigation choices
  • onCreateView callback method / Event handling, Dialog identity, Wrapping an existing dialog in a fragment
  • onCreateView method / Wrapping the list in a fragment, Making the fragment self-contained, Encapsulating fragment operations, Understanding fragment setup and display, Avoiding method name confusion, Understanding fragment hide and teardown, Maximizing available resources, Managing a fragment state, Layout, Managing asynchronous creation, Putting it all together
  • onDestroy method / Understanding fragment hide and teardown, Maximizing available resources, Managing the swipe fragments, Managing tab selection
  • onDestroyView method / Understanding fragment hide and teardown, Maximizing available resources, Managing the swipe fragments
  • onDetach method / Understanding fragment hide and teardown, Maximizing available resources, Managing tab selection
  • onListItemClick method / Handling ListFragment item selection
  • onResume method / Understanding fragment setup and display
  • onSaveInstanceState method / Managing a fragment state, Managing the swipe fragments
  • onSelectedBookChanged method / Defining the callback interface, Fragment notification, Making the MainActivity class adaptive, Handling ListFragment item selection, Transitioning between fragments, Eliminating redundant handling, Putting it all together
  • OnSelectedBookChangeListener interface / Fragment notification
  • OnSelectionChangeListener interface / Handling ListFragment item selection
  • onStart method / Understanding fragment setup and display
  • onStop method / Understanding fragment hide and teardown
  • onTabSelected method / Managing tab selection
  • onTabUnselected method / Managing tab selection

P

  • PagerTitleStrip class / Putting the swipe UI into place
  • PagerTitleStrip instance / Putting the swipe UI into place
  • position parameter / Handling ListFragment item selection

R

  • RadioGroup element / Defining the activity appearance, Defining the layout as a reusable list
  • redundant handling
    • eliminating / Eliminating redundant handling
  • remove method / Adding and removing fragments
  • replace method / Adding and removing fragments, Creating the fragment on-the-fly
  • resources
    • maximizing / Maximizing available resources
  • resource screen size groups / Resource screen size groups
  • resource screen size qualifiers / Resource screen size qualifiers
  • reusable list
    • layout, defining / Defining the layout as a reusable list

S

  • screen management / Intentional screen management
  • screen size
    • fragment layout, managing by / Managing fragment layout by screen size
    • resource screen size groups / Resource screen size groups
    • resource screen size qualifiers / Resource screen size qualifiers
  • screen size qualifiers
    • smallest width screen size qualifier / Resource screen size qualifiers
    • available width screen size qualifier / Resource screen size qualifiers
    • available height screen size qualifier / Resource screen size qualifiers
  • ScrollView element / Defining the activity appearance, Defining the layout as a reusable list, Minimize assumptions, Converting the activity to use fragments
  • setAdapter method / Putting the swipe UI into place
  • setArguments method / Managing asynchronous creation, Putting it all together
  • setBook method / Encapsulating fragment operations, Managing asynchronous creation
  • setContentView method / Displaying the activity UI, Understanding fragment setup and display, Adapting to device differences, Putting the swipe UI into place, Connecting the fragments to the tabs
  • setCustomAnimations method / Creating the fragment on-the-fly
  • setDisplayShowTitleEnabled method / Providing the navigation choices
  • setListAdapter method / Associating data with the list
  • setListNavigationCallbacks method / Providing the navigation choices
  • setNavigationMode method / Providing the navigation choices
  • setStyle method / Styles
  • setText method / Managing asynchronous creation
  • setTitle method / Accessing Dialog related behavior
  • show method / DialogFragment display, Wrapping an existing dialog in a fragment
  • SimpleTabListener class / Managing tab selection
  • smallest width screen size qualifier / Resource screen size qualifiers
  • startActivity method / Supporting the back button, Transitioning between fragments
  • string-array element / Separating data from display
  • Styles / Styles
  • swipe
    • used, for making navigation / Making navigation fun with swipe
  • swipe navigation
    • implementing / Implementing swipe navigation
    • swipe fragments, managing / Managing the swipe fragments
    • swipe UI, placing / Putting the swipe UI into place
    • about / Android Studio and swipe navigation
  • switch statement / Managing fragment selection

T

  • TabListener interface / Managing tab selection
  • TabListener interface method / Managing tab selection
  • tabs
    • navigating with / Navigating randomly with tabs
    • managing / Managing tab selection
    • fragments, connecting to / Connecting the fragments to the tabs
  • TextView element / Defining the activity appearance
  • TextView instance / Managing asynchronous creation
  • tools$layout attribute / Converting the activity to use fragments
  • transaction changes
    • executing / Deferred execution of transaction changes

U

  • UI creation
    • need for / The need for a new approach to UI creation
  • UI flexibility
    • creating / Creating UI flexibility
    • fragment layout / Dynamic fragment layout selection
    • fragments, designing for flexibility / Design fragments for flexibility

V

  • View.OnClickListener interface / DialogFragment, Event handling
  • ViewGroup instance / Wrapping the list in a fragment
  • ViewPager class / Putting the swipe UI into place
  • ViewPager instance / Putting the swipe UI into place
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image