to top
Android APIs
Sample Code >

app - API 4+ Support Demos

← Back

This section includes samples showing the use of the application package features of the static support library, in particular fragments and loaders.

Fragment

Fragment Alert Dialog
Demonstrates how to use a DialogFragment to show and manage an AlertDialog.
Fragment Arguments
Demonstrates how a fragment can be initialized with arguments, supplying them either as an argument Bundle at runtime or XML attributes in a <fragment> tag.
Fragment Context Menu
Demonstrates how to display and respond to a context menu that is display from a fragment's view hierarchy.
Fragment Custom Animation
Demonstrates the use of a custom animation for pushing and popping fragments on the back stack.
Fragment Dialog
Demonstrates use of DialogFragment to show various types of dialogs.
Fragment Dialog or Activity
Demonstrates how the same Fragment implementation can be used to provide the UI for either an Activity or Dialog.
Fragment Hide Show
Demonstrates hiding and showing fragments.
Fragment Layout
Demonstrates use of the <fragment> tag to embed a Fragment in an Activity's content view layout, and making the layout change based on configuration to achieve different UI flows.
Fragment List Array
Demonstrates use of ListFragment to show the contents of a simple ArrayAdapter.
Fragment Menu
Demonstrates populating custom menu items from a Fragment.
Fragment Pager Support
Demonstrates the use of the support class ViewPager with a FragmentPagerAdapter to build a user interface where the user can fling left or right to switch between fragments.
Fragment State Pager Support
Demonstrates the use of the support class ViewPager with a FragmentStatePagerAdapter to build a user interface where the user can fling left or right to switch between fragments. This versions of the adapter doesn't keep around the fragment instances that ViewPager has destroyed.
Fragment Receive Result
Demonstrates starting a new Activity from a Fragment, and receiving a result back from it.
Fragment Retain Instance
Demonstrates a Fragment can be used to easily retain active state across an Activity's configuration change.
Fragment Stack
Demonstrates creating a stack of Fragment instances similar to the traditional stack of activities.
Fragment Tabs
Demonstrates the use of fragments to implement switching between tabs in a TabHost.
Fragment Tabs Pager
Demonstrates the use of fragments to implement switching between tabs in a TabHost, using a ViewPager to manager the fragments so that the user can also fling left and right to switch tabs.

LoaderManager

Loader Cursor
Demonstrates use of LoaderManager to perform a query for a Cursor that populates a ListFragment.
Loader Custom
Demonstrates implementation and use of a custom Loader class. The custom class here "loads" the currently installed applications.
Loader Throttle
Complete end-to-end demonstration of a simple content provider that populates data in a list through a cursor loader. The UI allows the list to be populated with a series of items, showing how AsyncTaskLoader's throttling facility can be used to control how much a Loader is refreshed in this case.

Files