diff options
author | Scott Main <smain@google.com> | 2013-08-01 22:36:03 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-01 22:36:03 +0000 |
commit | 8709fb2a7175faa3b53cec7869f4b7594371b882 (patch) | |
tree | 0264c30e0f00ed50b2904b7a6582dc30fb3c0a35 /docs/html | |
parent | f0e0cf4e0de6f5bd578d3d916476bb529efea895 (diff) | |
parent | d797c3caec8ea50373dcd6630f28561b7671a10d (diff) | |
download | frameworks_base-8709fb2a7175faa3b53cec7869f4b7594371b882.zip frameworks_base-8709fb2a7175faa3b53cec7869f4b7594371b882.tar.gz frameworks_base-8709fb2a7175faa3b53cec7869f4b7594371b882.tar.bz2 |
Merge "update Getting Started class about fragments to remove support lib lesson and mention the action bar library, then update any links and add redirect bug: 10000221" into jb-mr2-docs
Diffstat (limited to 'docs/html')
-rw-r--r-- | docs/html/_redirects.yaml | 3 | ||||
-rw-r--r-- | docs/html/sitemap.txt | 1 | ||||
-rw-r--r-- | docs/html/training/basics/fragments/creating.jd | 37 | ||||
-rw-r--r-- | docs/html/training/basics/fragments/index.jd | 3 | ||||
-rw-r--r-- | docs/html/training/implementing-navigation/index.jd | 6 | ||||
-rw-r--r-- | docs/html/training/training_toc.cs | 4 |
6 files changed, 32 insertions, 22 deletions
diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml index c23ee10..5f0779c 100644 --- a/docs/html/_redirects.yaml +++ b/docs/html/_redirects.yaml @@ -21,6 +21,9 @@ redirects: - from: /sdk/compatibility-library.html to: /tools/support-library/index.html +- from: /training/basics/fragments/support-lib.html + to: /tools/support-library/setup.html + - from: /sdk/eclipse-adt.html to: /tools/sdk/eclipse-adt.html diff --git a/docs/html/sitemap.txt b/docs/html/sitemap.txt index 6291a3e..3a416f9 100644 --- a/docs/html/sitemap.txt +++ b/docs/html/sitemap.txt @@ -362,7 +362,6 @@ http://developer.android.com/training/basics/supporting-devices/index.html http://developer.android.com/training/basics/supporting-devices/languages.html http://developer.android.com/training/basics/supporting-devices/screens.html http://developer.android.com/training/basics/supporting-devices/platforms.html -http://developer.android.com/training/basics/fragments/support-lib.html http://developer.android.com/training/basics/fragments/creating.html http://developer.android.com/training/basics/fragments/fragment-ui.html http://developer.android.com/training/basics/fragments/communicating.html diff --git a/docs/html/training/basics/fragments/creating.jd b/docs/html/training/basics/fragments/creating.jd index b5df4e1..377adfc 100644 --- a/docs/html/training/basics/fragments/creating.jd +++ b/docs/html/training/basics/fragments/creating.jd @@ -6,7 +6,7 @@ trainingnavtop=true <div id="tb-wrapper"> <div id="tb"> - + <h2>This lesson teaches you to</h2> <ol> <li><a href="#Create">Create a Fragment Class</a></li> @@ -19,7 +19,7 @@ trainingnavtop=true </ul> <h2>Try it out</h2> - + <div class="download-box"> <a href="http://developer.android.com/shareables/training/FragmentBasics.zip" class="button">Download the sample</a> @@ -32,21 +32,30 @@ class="button">Download the sample</a> <p>You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities). This lesson shows how to -extend the {@link android.support.v4.app.Fragment} class using the Support Library so your app -remains compatible with devices running system versions as old as Android 1.6.</p> +extend the {@link android.support.v4.app.Fragment} class using the <a +href="{@docRoot}tools/support-library/index.html">Support Library</a> so your app +remains compatible with devices running system versions as low as Android 1.6.</p> -<p class="note"><strong>Note:</strong> If you decide for other reasons that the minimum +<p class="note"><strong>Note:</strong> If you decide that the minimum API level your app requires is 11 or higher, you don't need to use the Support Library and can instead use the framework's built in {@link android.app.Fragment} class and related APIs. Just be aware that this lesson is focused on using the APIs from the Support Library, which use a specific package signature and sometimes slightly different API names than the versions included in the platform.</p> +<p>Before you begin this lesson, you must set up your Android project to use the Support Library. +If you have not used the Support Library before, set up your project to use the <strong>v4</strong> +library by following the <a href="{@docRoot}tools/support-library/setup.html">Support Library +Setup</a> document. However, you can also include the <a href= +"{@docRoot}guide/topics/ui/actionbar.html">action bar</a> in your activities by instead using the +<strong>v7 appcompat</strong> library, which is compatible with Android 2.1 (API level 7) +and also includes the {@link android.support.v4.app.Fragment} APIs.</p> + <h2 id="Create">Create a Fragment Class</h2> -<p>To create a fragment, extend the {@link android.support.v4.app.Fragment} class, then override +<p>To create a fragment, extend the {@link android.support.v4.app.Fragment} class, then override key lifecycle methods to insert your app logic, similar to the way you would with an {@link android.app.Activity} class.</p> @@ -63,7 +72,7 @@ import android.view.ViewGroup; public class ArticleFragment extends Fragment { @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.article_view, container, false); @@ -82,7 +91,7 @@ href="{@docRoot}guide/components/fragments.html">Fragments</a> developer guide.< -<h2 id="AddInLayout">Add a Fragment to an Activity using XML</h2> +<h2 id="AddInLayout">Add a Fragment to an Activity using XML</h2> <p>While fragments are reusable, modular UI components, each instance of a {@link android.support.v4.app.Fragment} class must be associated with a parent {@link @@ -98,7 +107,7 @@ regular {@link android.app.Activity}.</p> screen is considered "large" (specified by the <code>large</code> qualifier in the directory name).</p> -<p><code>res/layout-large/news_articles.xml:</code></p> +<p class="code-caption">res/layout-large/news_articles.xml</p> <pre> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" @@ -120,11 +129,11 @@ name).</p> </LinearLayout> </pre> -<p class="note"><strong>Tip:</strong> For more information about creating layouts for different +<p class="note"><strong>Tip:</strong> For more about creating layouts for different screen sizes, read <a href="{@docRoot}training/multiscreen/screensizes.html">Supporting Different Screen Sizes</a>.</p> -<p>Here's how an activity applies this layout:</p> +<p>Then apply the layout to your activity:</p> <pre> import android.os.Bundle; @@ -139,6 +148,12 @@ public class MainActivity extends FragmentActivity { } </pre> +<p>If you're using the <a href="{@docRoot}tools/support-library/features.html#v7-appcompat">v7 +appcompat library</a>, your activity should instead extend {@link +android.support.v7.app.ActionBarActivity}, which is a subclass of {@link +android.support.v4.app.FragmentActivity} (for more information, +read <a href="{@docRoot}training/basics/actionbar/index.html">Adding the Action Bar</a>).</p> + <p class="note"><strong>Note:</strong> When you add a fragment to an activity layout by defining the fragment in the layout XML file, you <em>cannot</em> remove the fragment at runtime. If you plan diff --git a/docs/html/training/basics/fragments/index.jd b/docs/html/training/basics/fragments/index.jd index 1b82f2c..987decf 100644 --- a/docs/html/training/basics/fragments/index.jd +++ b/docs/html/training/basics/fragments/index.jd @@ -57,9 +57,6 @@ devices running versions as old as Android 1.6.</p> <h2>Lessons</h2> <dl> - <dt><b><a href="support-lib.html">Using the Android Support Library</a></b></dt> - <dd>Learn how to use more recent framework APIs in earlier versions of Android by bundling -the Android Support Library into your app.</dd> <dt><b><a href="creating.html">Creating a Fragment</a></b></dt> <dd>Learn how to build a fragment and implement basic behaviors within its callback methods.</dd> diff --git a/docs/html/training/implementing-navigation/index.jd b/docs/html/training/implementing-navigation/index.jd index 5b65716..24c98f2 100644 --- a/docs/html/training/implementing-navigation/index.jd +++ b/docs/html/training/implementing-navigation/index.jd @@ -47,9 +47,9 @@ understand how to provide proper <em>Up</em> and <em>Back</em> navigation.</p> <p class="note"><strong>Note:</strong> Several elements of this class require the <a href="{@docRoot}tools/support-library/index.html">Support Library</a> APIs. -If you have not used the Support Library before, follow the lesson about <a -href="{@docRoot}training/basics/fragments/support-lib.html">Using the Support Library</a> -to get your project set up.</p> +If you have not used the Support Library before, follow the instructions +in the <a href="{@docRoot}tools/support-library/setup.html">Support Library Setup</a> +document.</p> <h2 id="lessons">Lessons</h2> diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs index 6661889..c99fc96 100644 --- a/docs/html/training/training_toc.cs +++ b/docs/html/training/training_toc.cs @@ -129,10 +129,6 @@ include the action bar on devices running Android 2.1 or higher." >Building a Dynamic UI with Fragments</a> </div> <ul> - <li><a href="<?cs var:toroot ?>training/basics/fragments/support-lib.html"> - Using the Support Library - </a> - </li> <li><a href="<?cs var:toroot ?>training/basics/fragments/creating.html"> Creating a Fragment </a> |