blob: df715520daa866f0af87ee1686d78e8a309a7838 [file] [log] [blame]
Robert Ly8db858f2011-10-18 13:30:47 -07001page.title=Support Package
Scott Main28fb09e2011-05-23 17:27:17 -07002
3@jd:body
4
5<div id="qv-wrapper">
6<div id="qv">
Joe Fernandez71d5c1d2011-12-15 22:33:41 -08007
Scott Main28fb09e2011-05-23 17:27:17 -07008<h2>In this document</h2>
9<ol>
10 <li><a href="#Notes">Revisions</a></li>
Robert Ly8db858f2011-10-18 13:30:47 -070011 <li><a href="#Downloading">Downloading the Support Package</a></li>
Scott Mainaecaf932011-07-14 10:01:42 -070012 <li><a href="#SettingUp">Setting Up a Project to Use a Library</a></li>
13 <li><a href="#Using">Using the v4 Library APIs</a></li>
14 <li><a href="#Docs">Reference Docs</a></li>
Scott Main28fb09e2011-05-23 17:27:17 -070015 <li><a href="#Samples">Samples</a></li>
16</ol>
17
18<h2>See also</h2>
19<ol>
20 <li><a
21href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android 3.0</a></li>
22 <li><a href="http://code.google.com/p/iosched/">Google I/O App source code</a></li>
23</ol>
24
25</div>
26</div>
27
28<p><em>Minimum API level supported:</em> <b>4</b></p>
29
Robert Ly8db858f2011-10-18 13:30:47 -070030<p>The Support Package includes static "support libraries" that you can add to your Android
Scott Mainaecaf932011-07-14 10:01:42 -070031application in order to use APIs that are either not available for older platform versions or that
32offer "utility" APIs that aren't a part of the framework APIs. The goal is to simplify your
Scott Mainffcbe482011-07-15 09:50:49 -070033development by offering more APIs that you can bundle with your application so you can
Scott Mainaecaf932011-07-14 10:01:42 -070034worry less about platform versions.</p>
Scott Main28fb09e2011-05-23 17:27:17 -070035
Robert Ly8db858f2011-10-18 13:30:47 -070036<p class="note"><strong>Note:</strong> The Support Package includes more than one support
Scott Mainffcbe482011-07-15 09:50:49 -070037library. Each one has a different <em>minimum API level</em>. For example, one library requires API
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080038level 4 or higher, while another requires API level 13 or higher (v13 is a superset of v4 and
39includes additional
Robert Ly8db858f2011-10-18 13:30:47 -070040support classes to work with v13 APIs). The minimum version is indicated
Scott Mainffcbe482011-07-15 09:50:49 -070041by the directory name, such as {@code v4/} and {@code v13/}.</p>
Scott Main28fb09e2011-05-23 17:27:17 -070042
43
44<h2 id="Notes">Revisions</h2>
45
46<p>The sections below provide notes about successive releases of
Robert Ly8db858f2011-10-18 13:30:47 -070047the Support Package, as denoted by revision number.</p>
48
Scott Main28fb09e2011-05-23 17:27:17 -070049
Scott Main28fb09e2011-05-23 17:27:17 -070050<div class="toggle-content open">
51
52 <p><a href="#" onclick="return toggleContent(this)">
53 <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" />
Joe Fernandeze4f20312011-12-15 13:23:53 -080054 Support Package, revision 6 (December 2011)
55 </a></p>
56
57 <div class="toggle-content-toggleme" style="padding-left:2em">
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080058 <p class="note"><strong>Note:</strong> Reference for support library APIs are now available with
59 the framework references, for example: {@link android.support.v4.app}.</p>
60<dl>
Joe Fernandeze4f20312011-12-15 13:23:53 -080061 <dt>Changes for v4 support library:</dt>
62 <dd>
63 <ul>
64 <li>Changes to ViewPager:
65 <ul>
66 <li>Added extra decorative view support for {@link android.support.v4.view.ViewPager}.
67 Decorative views may be supplied as child views of a pager in XML layout.</li>
68 <li>Added {@link android.support.v4.view.PagerAdapter#getPageTitle
69 PagerAdapter.getPageTitle()} to supply title strings for pages, which defaults to no
70 title for each page.</li>
71 <li>Added {@link android.support.v4.view.PagerTitleStrip}, a non-interactive title
72 strip, that can be added as a child of ViewPager. Developers can supply text
73 appearance and color, as well as layout sizing and gravity information.</li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080074 <li>Updated {@link android.support.v4.view.PagerAdapter} methods to take ViewGroup
75 objects, rather than View to avoid class casting in adapter implementations.</li>
76 <li>Updated {@link android.support.v4.view.ViewPager} to use Launcher-style
77 fling behavior.</li>
Joe Fernandeze4f20312011-12-15 13:23:53 -080078 <li>Bug fixes for user interface interaction and test automation.</li>
79 </ul>
80 </li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080081
Joe Fernandeze4f20312011-12-15 13:23:53 -080082 <li>Support for Fragments:
83 <ul>
84 <li>Changed {@code setStartDeferred()} method to {@link
85 android.support.v4.app.Fragment#setUserVisibleHint}.</li>
86 <li>Added deferred start for off-screen pages to improve performance.</li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080087 </ul>
Joe Fernandeze4f20312011-12-15 13:23:53 -080088 </li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080089
Joe Fernandeze4f20312011-12-15 13:23:53 -080090 <li>Support for Accessiblity APIs:
91 <ul>
92 <li>Updated {@link android.support.v4.view.AccessibilityDelegateCompat} methods
93 to return empty lists instead of null.</li>
94 <li>Added new APIs needed by the v4 samples.</li>
95 </ul>
96 </li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -080097
Joe Fernandeze4f20312011-12-15 13:23:53 -080098 </ul>
99 </dd>
100 </dl>
101 </div>
102
103<div class="toggle-content closed">
104
105 <p><a href="#" onclick="return toggleContent(this)">
106 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
107 Support Package, revision 5 (December 2011)
Robert Ly8db858f2011-10-18 13:30:47 -0700108 </a></p>
109
110 <div class="toggle-content-toggleme" style="padding-left:2em">
111 <dl>
112 <dt>Changes for v4 support library:</dt>
113 <dd>
114 <ul>
115 <li>Support for Accessiblity APIs:
116 <ul>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800117 <li>Added {@link android.support.v4.view.AccessibilityDelegateCompat}
118 to support {@link android.view.View.AccessibilityDelegate}.</li>
Robert Ly8db858f2011-10-18 13:30:47 -0700119
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800120 <li>Added {@link android.support.v4.view.accessibility.AccessibilityEventCompat}
121 to support {@link android.view.accessibility.AccessibilityEvent}.</li>
Robert Ly8db858f2011-10-18 13:30:47 -0700122
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800123 <li>Added {@link android.support.v4.view.accessibility.AccessibilityManagerCompat}
124 to support {@link android.view.accessibility.AccessibilityManager}.</li>
Robert Ly8db858f2011-10-18 13:30:47 -0700125
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800126 <li>Added {@link android.support.v4.view.accessibility.AccessibilityNodeInfoCompat}
127 to support {@link android.view.accessibility.AccessibilityNodeInfo}.</li>
Robert Ly8db858f2011-10-18 13:30:47 -0700128
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800129 <li>Added {@link android.support.v4.view.accessibility.AccessibilityRecordCompat}
130 to support {@link android.view.accessibility.AccessibilityRecord}.</li>
Robert Ly8db858f2011-10-18 13:30:47 -0700131
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800132 <li>Added {@link
133 android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat}
134 to support {@link android.accessibilityservice.AccessibilityServiceInfo}.</li>
Robert Ly8db858f2011-10-18 13:30:47 -0700135
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800136 <li>Added {@link android.support.v4.view.ViewGroupCompat}
Robert Ly8db858f2011-10-18 13:30:47 -0700137 to support accessibility features in {@link android.view.ViewGroup}.
138 </li>
139
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800140 <li>Modified {@link android.support.v4.view.ViewCompat}
Robert Ly8db858f2011-10-18 13:30:47 -0700141 to support accessibility features in {@link android.view.View}.</li>
142 </ul>
143 </li>
144
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800145 <li>Changes to ViewPager:
Joe Fernandeze4f20312011-12-15 13:23:53 -0800146 <ul>
147 <li>Added support for margins between pages.
148 An optional {@link android.graphics.drawable.Drawable} can be provided
149 to fill the margins.</li>
150 <li>Added support for {@link android.widget.EdgeEffect}.</li>
151 <li>Added support for keyboard navigation</li>
152 <li>Added support to control how many pages are kept to either side
153 of the current page.</li>
154 <li>Improved touch physics.</li>
155 <li>Bug fixes for user interface behavior.</li>
156 </ul>
157 </li>
158 </ul>
159 </dd>
160 </dl>
161 </div>
162
163<div class="toggle-content closed">
164
165 <p><a href="#" onclick="return toggleContent(this)">
166 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
167 Support Package, revision 4 (October 2011)
168 </a></p>
169
170 <div class="toggle-content-toggleme" style="padding-left:2em">
171 <dl>
172 <dt>Changes for v4 support library:</dt>
173 <dd>
174 <ul>
Robert Ly8db858f2011-10-18 13:30:47 -0700175 <li>Added <code>EdgeEffectCompat</code> to
176 support {@link android.widget.EdgeEffect}.</li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800177
Robert Ly8db858f2011-10-18 13:30:47 -0700178 <li>Added <code>LocalBroadcastManager</code> to allow applications to easily
179 register for and receive intents within a single application without
180 broadcasting them globally.</li>
181
182 <li>Added support in <code>ViewCompat</code> to check for and set overscroll
183 modes for {@link android.view.View}s on Android 2.3 and later.</li>
184 <li>Changes to Fragment APIs:
185 <ul>
186 <li>Added new APIs to control the visibility of new menus.</li>
187 <li>Added custom animation APIs.</li>
188 <li>Added APIs in <code>FragmentActivity</code> to retain custom,
189 non-configuration instance data.</li>
190 <li>Various bug fixes.</li>
191 </ul>
192 </li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800193
Robert Ly8db858f2011-10-18 13:30:47 -0700194 <li>Fixed a {@link android.content.Loader} bug that caused issues in
195 canceling {@link android.os.AsyncTask}s when running on Froyo and older
196 versions of the platform. The support
197 code now uses its own version of {@link android.os.AsyncTask} to keep the same
198 behavior on all platform versions.</li>
199
200 </ul>
201 </dd>
202 </dl>
203 </div>
204
205
206
207</div>
208
209
210<div class="toggle-content closed">
211
212 <p><a href="#" onclick="return toggleContent(this)">
213 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
Scott Mainaecaf932011-07-14 10:01:42 -0700214 Compatibility Package, revision 3 (July 2011)
Scott Main28fb09e2011-05-23 17:27:17 -0700215 </a></p>
216
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800217 <div class="toggle-content-toggleme" style="padding-left:2em">
Scott Main28fb09e2011-05-23 17:27:17 -0700218 <dl>
Scott Mainaecaf932011-07-14 10:01:42 -0700219 <dt>Changes for v4 support library:</dt>
220 <dd>
221 <ul>
222 <li>Adds support for {@link android.app.Fragment.SavedState}</li>
223 <li>Adds {@code MotionEventCompat} to support newer {@link
224android.view.MotionEvent} APIs</li>
225 <li>Adds {@code VelocityTrackerCompat} to support a newer {@link
226android.view.VelocityTracker} APIs</li>
227 <li>Adds {@code ViewConfigurationCompat} to support a newer {@link
228android.view.ViewConfiguration} APIs</li>
229 <li>All new APIs (available only in the support library) that allow you to create UIs
Scott Mainffcbe482011-07-15 09:50:49 -0700230with horizontal paging, allowing users to swipe left and right between content views. Classes to
231support this include:
Scott Mainaecaf932011-07-14 10:01:42 -0700232 <ul>
233 <li>{@code ViewPager}: A {@link android.view.ViewGroup} that manages the
234layout for the child views, which the user can swipe between.</li>
235 <li>{@code PagerAdapter}: An adapter that populates the {@code ViewPager} with the
236views that represent each page.</li>
237 <li>{@code FragmentPagerAdapter}: An extension of {@code PagerAdapter} for flipping
238between fragments.</li>
Scott Mainffcbe482011-07-15 09:50:49 -0700239 <li>{@code FragmentStatePagerAdapter}: An extension of {@code PagerAdapter} for
240flipping between fragments that uses the library's support for {@link
241android.app.Fragment.SavedState}.</li>
Scott Mainaecaf932011-07-14 10:01:42 -0700242 </ul>
243 </li>
244 </ul>
245 </dd>
246 <dt>New v13 support library:</dt>
247 <dd>
248 <ul>
249 <li>Includes the {@code FragmentPagerAdapter} and {@code FragmentStatePagerAdapter}
250to support the horizontal paging.
251 <p>These are exactly the same as the APIs added to the v4 support library, but rely on
252other platform components in Android 3.2. Use this library instead of v4 if you're developing for
253Android 3.2 and higher (all other APIs in the v4 library are already available with API level
25413).</p>
255 </li>
256 </ul>
257 </dd>
258 </dl>
259 </div>
260
261</div>
262
263
264<div class="toggle-content closed">
265
266 <p><a href="#" onclick="return toggleContent(this)">
267 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
268 Compatibility Package, revision 2 (May 2011)
269 </a></p>
270
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800271 <div class="toggle-content-toggleme" style="padding-left:2em">
Scott Mainaecaf932011-07-14 10:01:42 -0700272 <dl>
273 <dt>Changes for v4 library:</dt>
Scott Main28fb09e2011-05-23 17:27:17 -0700274 <dd>
275 <ul>
Scott Mainaecaf932011-07-14 10:01:42 -0700276 <li>Support for fragment animations</li>
Joe Fernandeze4f20312011-12-15 13:23:53 -0800277 <li>Fix {@code android.support.v4.app.Fragment#onActivityResult Fragment.onActivityResult()}
278 bug</li>
Scott Main28fb09e2011-05-23 17:27:17 -0700279 </ul>
280 </dd>
281 </dl>
282 </div>
283
284</div>
285
286
287<div class="toggle-content closed">
288
289 <p><a href="#" onclick="return toggleContent(this)">
290 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
Scott Mainaecaf932011-07-14 10:01:42 -0700291 Compatibility Package, revision 1 (March 2011)
Scott Main28fb09e2011-05-23 17:27:17 -0700292 </a></p>
293
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800294 <div class="toggle-content-toggleme" style="padding-left:2em">
Scott Mainaecaf932011-07-14 10:01:42 -0700295 <p>Initial release with the v4 library.</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700296 </div>
297
298</div>
299
300
301
Robert Ly8db858f2011-10-18 13:30:47 -0700302<h2 id="Downloading">Downloading the Support Package</h2>
Scott Main28fb09e2011-05-23 17:27:17 -0700303
Robert Ly8db858f2011-10-18 13:30:47 -0700304<p>The Support Package is provided as a downloadable package from the Android SDK and AVD
Scott Mainaecaf932011-07-14 10:01:42 -0700305Manager. To install:</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700306
307<ol>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800308 <li>Launch the SDK and AVD Manager.
Scott Main28fb09e2011-05-23 17:27:17 -0700309 <p>From Eclipse, you can select <strong>Window</strong>
310&gt; <strong>Android SDK and AVD Manager</strong>. Or, launch {@code SDK Manager.exe} from
311the {@code &lt;sdk&gt;/} directory (on Windows only) or {@code android} from the {@code
312&lt;sdk&gt;/tools/} directory.</p></li>
Robert Ly8db858f2011-10-18 13:30:47 -0700313 <li>Expand the Android Repository, check <strong>Android Support package</strong>
Scott Main28fb09e2011-05-23 17:27:17 -0700314and click <strong>Install selected</strong>.</li>
315 <li>Proceed to install the package.</li>
316</ol>
317
Scott Mainaecaf932011-07-14 10:01:42 -0700318<p>When done, all files (including source code, samples, and the {@code .jar} files) are saved
Robert Ly8db858f2011-10-18 13:30:47 -0700319into the <code>&lt;sdk&gt;/extras/android/support/</code> directory. This directory contains
Scott Mainaecaf932011-07-14 10:01:42 -0700320each of the different support libraries, such as the library for API level 4 and up and the library
321for API level 13 and up, each named with the respective version (such as {@code v4/}).</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700322
323
Scott Mainaecaf932011-07-14 10:01:42 -0700324<h2 id="SettingUp">Setting Up a Project to Use a Library</h2>
Scott Main28fb09e2011-05-23 17:27:17 -0700325
Scott Mainaecaf932011-07-14 10:01:42 -0700326<p>To add one of the libraries to your Android project:</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700327<ol>
328 <li>In your Android project, create a directory named {@code libs} at the root of your
329project (next to {@code src/}, {@code res/}, etc.)</li>
Scott Mainaecaf932011-07-14 10:01:42 -0700330 <li>Locate the JAR file for the library you want to use and copy it into the {@code
331libs/} directory.
332 <p>For example, the library that supports API level 4 and up is located at {@code
Robert Ly8db858f2011-10-18 13:30:47 -0700333&lt;sdk&gt;/extras/android/support/v4/android-support-v4.jar}.</p>
Scott Mainaecaf932011-07-14 10:01:42 -0700334 </li>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800335 <li>Add the JAR to your project build path.
Scott Mainaecaf932011-07-14 10:01:42 -0700336 <p>In Eclipse, right-click the JAR file in the Package Explorer, select <strong>Build
Joe Fernandeze4f20312011-12-15 13:23:53 -0800337Path</strong> &gt; <strong>Add to Build Path</strong>.</p>
Scott Mainaecaf932011-07-14 10:01:42 -0700338 </li>
Scott Main28fb09e2011-05-23 17:27:17 -0700339</ol>
340
Scott Mainaecaf932011-07-14 10:01:42 -0700341<p>Your application is now ready to use the library APIs. All the
342provided APIs are available in the {@code android.support} package (for
343example, {@code android.support.v4}).</p>
344
345<p class="note"><strong>Tip:</strong> To see the library APIs in action, take a look at the sample
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800346apps in {@code &lt;sdk&gt;/extras/android/support/&lt;version&gt;/samples/}.</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700347
348<p class="warning"><strong>Warning:</strong> Be certain that you not confuse the standard
Scott Mainaecaf932011-07-14 10:01:42 -0700349{@code android} packages with those in {@code android.support} library. Some code completion tools
350might
Scott Main28fb09e2011-05-23 17:27:17 -0700351get this wrong, especially if you're building against recent versions of the platform. To be safe,
352keep your build target set to the same version as you have defined for your <a
353href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
Scott Mainaecaf932011-07-14 10:01:42 -0700354and double check the import statements for classes that also exist in the support library, such as
355{@code SimpleCursorAdapter}.</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700356
357
Scott Mainaecaf932011-07-14 10:01:42 -0700358<h2 id="Using">Using the v4 Library APIs</h2>
Scott Main28fb09e2011-05-23 17:27:17 -0700359
Scott Mainaecaf932011-07-14 10:01:42 -0700360<p>The support library for v4 provides access to several classes introduced with Android 3.0 and
361beyond, plus some updated version of existing classes, and even some APIs that currently don't
362exist in the Android platform. Some of the most useful and notable classes that have
363counterparts in the v4 support library are:</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700364
365<ul>
366 <li>{@link android.app.Fragment}</li>
367 <li>{@link android.app.FragmentManager}</li>
368 <li>{@link android.app.FragmentTransaction}</li>
369 <li>{@link android.app.ListFragment}</li>
370 <li>{@link android.app.DialogFragment}</li>
371 <li>{@link android.app.LoaderManager}</li>
372 <li>{@link android.content.Loader}</li>
373 <li>{@link android.content.AsyncTaskLoader}</li>
374 <li>{@link android.content.CursorLoader}</li>
375</ul>
376
377<p>For each of the classes above (and others not listed), the APIs work almost exactly the same
Scott Mainaecaf932011-07-14 10:01:42 -0700378as the counterparts in the latest Android platform. Thus, you can usually refer to
379the online documentation for information about the supported APIs. There are some
Scott Main28fb09e2011-05-23 17:27:17 -0700380differences, however. Most notably:</p>
381
382<ul>
383 <li>When creating an activity to use fragments, you must declare your activity to extend the
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800384{@link android.support.v4.app.FragmentActivity} class (instead of the traditional
385{@link android.app.Activity} class).</li>
386 <li>To manage your fragments and loaders, you must use the methods
387 {@link android.support.v4.app.FragmentActivity#getSupportFragmentManager
388 FragmentActivity.getSupportFragmentManager()} and
389 {@link android.support.v4.app.FragmentActivity#getSupportLoaderManager
390 FragmentActivity.getSupportLoaderManager()} (instead of the
391 {@link android.app.Activity#getFragmentManager()} and
392 {@link android.app.Activity#getLoaderManager()} methods).</li>
Scott Main28fb09e2011-05-23 17:27:17 -0700393 <li>The {@link android.app.ActionBar} is <strong>not supported</strong> by the library.
394However, when creating your <a href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options
395Menu</a>, you can declare which items should be added to the Action Bar when it's available (on
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800396Android 3.0 or later). You can do so with the
397{@link android.support.v4.view.MenuCompat#setShowAsAction MenuCompat.setShowAsAction()} method, for
Scott Main28fb09e2011-05-23 17:27:17 -0700398example:
399<pre>
400public boolean onCreateOptionsMenu(Menu menu) {
401 MenuInflater inflater = getMenuInflater();
402 inflater.inflate(R.menu.options, menu);
403 MenuCompat.setShowAsAction(menu.findItem(R.id.action_search), 1);
404 return true;
405}
406</pre>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800407<p>Also see the <a href="{@docRoot}resources/samples/ActionBarCompat/index.html">Action Bar
408Compatibility</a> sample for a demonstration of how to use {@link android.app.ActionBar} on Android
4093.0+ and also support action bar functionality on older versions.</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700410</li>
411</ul>
412
Scott Main28fb09e2011-05-23 17:27:17 -0700413<div class="note"><p><strong>Tip:</strong> To enable the Holographic theme on devices
414running Android 3.0 or higher, declare in your manifest file that your application targets
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800415API level 11, for example:</p>
Scott Main28fb09e2011-05-23 17:27:17 -0700416<pre>
417&lt;uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" /&gt;
418</pre>
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800419<p>This way, your application automatically receives the Holographic theme and the Action Bar for
Scott Main28fb09e2011-05-23 17:27:17 -0700420each activity when running on Android 3.0 and higher.</p>
421</div>
422
423<p>For more information about how you can optimize your application for the latest
424Android-powered devices, read <a href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing
425Apps for Android 3.0</a>.</p>
426
427
Scott Mainaecaf932011-07-14 10:01:42 -0700428<h2 id="Docs">Reference Docs</h2>
429
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800430<p>The reference documentation for the Support Packages is included as part of the Android
431online developer documentation:</p>
Scott Mainaecaf932011-07-14 10:01:42 -0700432
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800433<ul>
434 <li><a href="{@docRoot}reference/android/support/v4/app/package-summary.html">Support Package
435 API 4 Reference</a></li>
436 <li><a href="{@docRoot}reference/android/support/v13/app/package-summary.html">Support Package
437 API 13 Reference</a></li>
438</ul>
Scott Mainaecaf932011-07-14 10:01:42 -0700439
440
Scott Main28fb09e2011-05-23 17:27:17 -0700441<h2 id="Samples">Samples</h2>
442
Scott Mainaecaf932011-07-14 10:01:42 -0700443<p>If you want to see some code that uses the support libraries, samples are included with the
Joe Fernandez71d5c1d2011-12-15 22:33:41 -0800444Support Package, inside each support library directory, for example; {@code
445&lt;sdk&gt;/extras/android/support/v4/samples/}. You can also view these samples as part of the
446Android online developer documentation:</p>
447
448<ul>
449 <li><a href="{@docRoot}resources/samples/Support4Demos/index.html">Support API 4 Demos</a></li>
450 <li><a href="{@docRoot}resources/samples/Support13Demos/index.html">Support API 13 Demos</a></li>
451</ul>
Scott Main28fb09e2011-05-23 17:27:17 -0700452
453<p>Additionally, the <a href="http://code.google.com/p/iosched/">Google I/O App</a> is a complete
Scott Mainaecaf932011-07-14 10:01:42 -0700454application that uses the v4 support library to provide a single APK for both handsets and tablets
455and also demonstrates some of Android's best practices in Android UI design.</p>