Merge "first draft of sample code for AU basic training class on fragments" into ics-mr1
diff --git a/samples/training/basic/fragment-UI/AndroidManifest.xml b/samples/training/basic/fragment-UI/AndroidManifest.xml
new file mode 100644
index 0000000..15fb49e
--- /dev/null
+++ b/samples/training/basic/fragment-UI/AndroidManifest.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.android.basic.fragments"
+      android:versionCode="1"
+      android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
+    <application android:icon="@drawable/ic_launcher">
+
+    <!-- ActivityA example uses XML to create Fragments -->
+    <activity android:name=".ActivityA"
+              android:launchMode="singleTask"
+              android:label="@string/app_name_xml">
+        <intent-filter>
+            <action android:name="android.intent.action.MAIN" />
+            <category android:name="android.intent.category.LAUNCHER" />
+        </intent-filter>
+    </activity>
+
+    <!-- ActivityB example uses Java code to create Fragments -->
+    <activity android:name=".ActivityB"
+        android:launchMode="singleTask"
+        android:label="@string/app_name_code">
+        <intent-filter>
+            <action android:name="android.intent.action.MAIN" />
+            <category android:name="android.intent.category.LAUNCHER" />
+        </intent-filter>
+    </activity>
+
+    </application>
+</manifest> 
diff --git a/samples/training/basic/fragment-UI/Basic-activity-class.iml b/samples/training/basic/fragment-UI/Basic-activity-class.iml
new file mode 100644
index 0000000..fd9b97b
--- /dev/null
+++ b/samples/training/basic/fragment-UI/Basic-activity-class.iml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
+        <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
+        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/AndroidManifest.xml" />
+        <option name="RES_FOLDER_RELATIVE_PATH" value="/res" />
+        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/assets" />
+        <option name="LIBS_FOLDER_RELATIVE_PATH" value="/libs" />
+        <option name="REGENERATE_R_JAVA" value="true" />
+        <option name="REGENERATE_JAVA_BY_AIDL" value="true" />
+        <option name="USE_CUSTOM_APK_RESOURCE_FOLDER" value="false" />
+        <option name="CUSTOM_APK_RESOURCE_FOLDER" value="" />
+        <option name="USE_CUSTOM_COMPILER_MANIFEST" value="false" />
+        <option name="CUSTOM_COMPILER_MANIFEST" value="" />
+        <option name="APK_PATH" value="" />
+        <option name="LIBRARY_PROJECT" value="false" />
+        <option name="RUN_PROCESS_RESOURCES_MAVEN_TASK" value="true" />
+        <option name="GENERATE_UNSIGNED_APK" value="false" />
+        <option name="CUSTOM_DEBUG_KEYSTORE_PATH" value="" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="jdk" jdkName="Android 4.0 Google APIs" jdkType="Android SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/libs/android-support-v13.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+  </component>
+</module>
+
diff --git a/samples/training/basic/fragment-UI/Basic-fragment-class.iml b/samples/training/basic/fragment-UI/Basic-fragment-class.iml
new file mode 100644
index 0000000..a64b34c
--- /dev/null
+++ b/samples/training/basic/fragment-UI/Basic-fragment-class.iml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
+        <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
+        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/AndroidManifest.xml" />
+        <option name="RES_FOLDER_RELATIVE_PATH" value="/res" />
+        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/assets" />
+        <option name="LIBS_FOLDER_RELATIVE_PATH" value="/libs" />
+        <option name="REGENERATE_R_JAVA" value="true" />
+        <option name="REGENERATE_JAVA_BY_AIDL" value="true" />
+        <option name="USE_CUSTOM_APK_RESOURCE_FOLDER" value="false" />
+        <option name="CUSTOM_APK_RESOURCE_FOLDER" value="" />
+        <option name="USE_CUSTOM_COMPILER_MANIFEST" value="false" />
+        <option name="CUSTOM_COMPILER_MANIFEST" value="" />
+        <option name="APK_PATH" value="" />
+        <option name="LIBRARY_PROJECT" value="false" />
+        <option name="RUN_PROCESS_RESOURCES_MAVEN_TASK" value="true" />
+        <option name="GENERATE_UNSIGNED_APK" value="false" />
+        <option name="CUSTOM_DEBUG_KEYSTORE_PATH" value="" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
+    </content>
+    <orderEntry type="jdk" jdkName="Android 4.0 Google APIs" jdkType="Android SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="android" level="project" />
+  </component>
+</module>
+
diff --git a/samples/training/basic/fragment-UI/ant.properties b/samples/training/basic/fragment-UI/ant.properties
new file mode 100644
index 0000000..ee52d86
--- /dev/null
+++ b/samples/training/basic/fragment-UI/ant.properties
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked in Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+#  'source.dir' for the location of your java source folder and
+#  'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+#  'key.store' for the location of your keystore and
+#  'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
diff --git a/samples/training/basic/fragment-UI/build.properties b/samples/training/basic/fragment-UI/build.properties
new file mode 100644
index 0000000..ee52d86
--- /dev/null
+++ b/samples/training/basic/fragment-UI/build.properties
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked in Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+#  'source.dir' for the location of your java source folder and
+#  'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+#  'key.store' for the location of your keystore and
+#  'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
diff --git a/samples/training/basic/fragment-UI/build.xml b/samples/training/basic/fragment-UI/build.xml
new file mode 100644
index 0000000..2297984
--- /dev/null
+++ b/samples/training/basic/fragment-UI/build.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Dynamic UI Example" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <property file="local.properties" />
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties" />
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties" />
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
+            unless="sdk.dir"
+    />
+
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+     in between standard targets -->
+<!--
+    <target name="-pre-build">
+    </target>
+    <target name="-pre-compile">
+    </target>
+
+    /* This is typically used for code obfuscation.
+       Compiled code location: ${out.classes.absolute.dir}
+       If this is not done in place, override ${out.dex.input.absolute.dir} */
+    <target name="-post-compile">
+    </target>
+-->
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
diff --git a/samples/training/basic/fragment-UI/default.properties b/samples/training/basic/fragment-UI/default.properties
new file mode 100644
index 0000000..420db56
--- /dev/null
+++ b/samples/training/basic/fragment-UI/default.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=Google Inc.:Google APIs:8
diff --git a/samples/training/basic/fragment-UI/libs/android-support-v13.jar b/samples/training/basic/fragment-UI/libs/android-support-v13.jar
new file mode 100644
index 0000000..3d7f841
--- /dev/null
+++ b/samples/training/basic/fragment-UI/libs/android-support-v13.jar
Binary files differ
diff --git a/samples/training/basic/fragment-UI/local.properties b/samples/training/basic/fragment-UI/local.properties
new file mode 100644
index 0000000..838a831
--- /dev/null
+++ b/samples/training/basic/fragment-UI/local.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked in Version Control Systems,
+# as it contains information specific to your local configuration.
+
+# location of the SDK. This is only used by Ant
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=/Users/brutledge/android-sdk-macosx
+extensible.classpath=./libs/android-support-v13.jar
diff --git a/samples/training/basic/fragment-UI/proguard.cfg b/samples/training/basic/fragment-UI/proguard.cfg
new file mode 100644
index 0000000..b1cdf17
--- /dev/null
+++ b/samples/training/basic/fragment-UI/proguard.cfg
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
diff --git a/samples/training/basic/fragment-UI/project.properties b/samples/training/basic/fragment-UI/project.properties
new file mode 100644
index 0000000..c2368c1
--- /dev/null
+++ b/samples/training/basic/fragment-UI/project.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=Google Inc.\:Google APIs\:14
diff --git a/samples/training/basic/fragment-UI/res/drawable-hdpi/ic_launcher.png b/samples/training/basic/fragment-UI/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 0000000..6bb06c4
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/basic/fragment-UI/res/drawable-ldpi/ic_launcher.png b/samples/training/basic/fragment-UI/res/drawable-ldpi/ic_launcher.png
new file mode 100755
index 0000000..70ca1bf
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/drawable-ldpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/basic/fragment-UI/res/drawable-mdpi/ic_launcher.png b/samples/training/basic/fragment-UI/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 0000000..085b783
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/basic/fragment-UI/res/drawable-xhdpi/ic_launcher.png b/samples/training/basic/fragment-UI/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..bfa4007
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/basic/fragment-UI/res/layout-land/activity_a.xml b/samples/training/basic/fragment-UI/res/layout-land/activity_a.xml
new file mode 100644
index 0000000..6638a65
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/activity_a.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <fragment android:name="com.example.android.basic.fragments.FragmentA"
+          android:id="@+id/fragment_a"
+          android:layout_weight="1"
+          android:layout_width="match_parent"
+          android:layout_height="0dp" />
+
+    <fragment android:name="com.example.android.basic.fragments.FragmentB"
+          android:id="@+id/fragment_b"
+          android:layout_weight="1"
+          android:layout_width="match_parent"
+          android:layout_height="0dp" />
+
+</LinearLayout>
+
diff --git a/samples/training/basic/fragment-UI/res/layout-land/activity_b.xml b/samples/training/basic/fragment-UI/res/layout-land/activity_b.xml
new file mode 100644
index 0000000..9f4ee96
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/activity_b.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/main"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="0dp" />
+
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/content"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="0dp" />
+</LinearLayout>
+
diff --git a/samples/training/basic/fragment-UI/res/layout-land/fragment_a.xml b/samples/training/basic/fragment-UI/res/layout-land/fragment_a.xml
new file mode 100644
index 0000000..6004995
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/fragment_a.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+              android:background="@color/dark_blue"
+              android:padding="8dip">
+    <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/fragment_a_label"
+            android:gravity="center_horizontal"
+            android:textSize="@dimen/font_large"
+            android:textColor="@color/light_blue"
+            android:paddingBottom="16dip"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/layout-land/fragment_b.xml b/samples/training/basic/fragment-UI/res/layout-land/fragment_b.xml
new file mode 100644
index 0000000..eddf15b
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/fragment_b.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+              android:background="@color/dark_red"
+              android:padding="8dip">
+    <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/fragment_b_label"
+            android:gravity="center_horizontal"
+            android:textSize="@dimen/font_large"
+            android:textColor="@color/light_red"
+            android:paddingBottom="16dip"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/layout-xlarge/activity_a.xml b/samples/training/basic/fragment-UI/res/layout-xlarge/activity_a.xml
new file mode 100644
index 0000000..0f1baa7
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/activity_a.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <fragment android:name="com.example.android.basic.fragments.FragmentA"
+          android:id="@+id/fragment_a"
+          android:layout_weight="1"
+          android:layout_width="match_parent"
+          android:layout_height="0dp" />
+
+    <fragment android:name="com.example.android.basic.fragments.FragmentB"
+          android:id="@+id/fragment_b"
+          android:layout_weight="1"
+          android:layout_width="match_parent"
+          android:layout_height="0dp" />
+
+</LinearLayout>
+
diff --git a/samples/training/basic/fragment-UI/res/layout-xlarge/activity_b.xml b/samples/training/basic/fragment-UI/res/layout-xlarge/activity_b.xml
new file mode 100644
index 0000000..8b16e59
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/activity_b.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/main"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="0dp" />
+
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/content"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="0dp" />
+</LinearLayout>
+
diff --git a/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_a.xml b/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_a.xml
new file mode 100644
index 0000000..e3adb86
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_a.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:background="@color/dark_blue"
+              android:padding="8dp">
+    <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/fragment_a_label"
+            android:gravity="center_horizontal"
+            android:textSize="@dimen/font_large"
+            android:textColor="@color/light_blue"
+            android:paddingBottom="16dp"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_b.xml b/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_b.xml
new file mode 100644
index 0000000..6aa0c32
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_b.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:background="@color/dark_red"
+              android:padding="8dp">
+    <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/fragment_b_label"
+            android:gravity="center_horizontal"
+            android:textSize="@dimen/font_large"
+            android:textColor="@color/light_red"
+            android:paddingBottom="16dp"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/layout/activity_a.xml b/samples/training/basic/fragment-UI/res/layout/activity_a.xml
new file mode 100644
index 0000000..5d6077c
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/activity_a.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <fragment android:name="com.example.android.basic.fragments.FragmentA"
+              android:id="@+id/fragment_a"
+              android:layout_weight="1"
+              android:layout_width="match_parent"
+              android:layout_height="0dp" />
+
+</LinearLayout>
+
diff --git a/samples/training/basic/fragment-UI/res/layout/activity_b.xml b/samples/training/basic/fragment-UI/res/layout/activity_b.xml
new file mode 100644
index 0000000..03e779c
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/activity_b.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/main"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"/>
+
+
+
+
+
+
diff --git a/samples/training/basic/fragment-UI/res/layout/fragment_a.xml b/samples/training/basic/fragment-UI/res/layout/fragment_a.xml
new file mode 100644
index 0000000..31b0ceb
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/fragment_a.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:background="@color/dark_blue"
+    android:padding="8dip">
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/fragment_a_label"
+        android:gravity="center_horizontal"
+        android:textSize="@dimen/font_large"
+        android:textColor="@color/light_blue"
+        android:paddingBottom="16dip"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/layout/fragment_b.xml b/samples/training/basic/fragment-UI/res/layout/fragment_b.xml
new file mode 100644
index 0000000..90364d8
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/fragment_b.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:background="@color/dark_red"
+    android:padding="8dip">
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/fragment_b_label"
+        android:gravity="center_horizontal"
+        android:textSize="@dimen/font_large"
+        android:textColor="@color/light_red"
+        android:paddingBottom="16dip"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/values/colors.xml b/samples/training/basic/fragment-UI/res/values/colors.xml
new file mode 100644
index 0000000..9a56074
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/values/colors.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<resources>
+    <color name="light_blue">#A8DFF4</color>
+    <color name="light_green">#D3E992</color>
+    <color name="light_red">#FFAFAF</color>
+    <color name="light_yellow">#FFECC0</color>
+
+    <color name="dark_blue">#0099CC</color>
+    <color name="dark_green">#669900</color>
+    <color name="dark_red">#CC0000</color>
+    <color name="dark_yellow">#FF8A00</color>
+</resources>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/values/dimensions.xml b/samples/training/basic/fragment-UI/res/values/dimensions.xml
new file mode 100644
index 0000000..72ef859
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/values/dimensions.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<resources>
+    <dimen name="font_large">44dp</dimen>
+    <dimen name="font_medium">24dp</dimen>
+    <dimen name="font_small">10dp</dimen>
+</resources>
\ No newline at end of file
diff --git a/samples/training/basic/fragment-UI/res/values/strings.xml b/samples/training/basic/fragment-UI/res/values/strings.xml
new file mode 100644
index 0000000..9598340
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/values/strings.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2012 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<resources>
+    <string name="app_name">Dynamic UI Example</string>
+    <string name="app_name_xml">Fragments XML Example</string>
+    <string name="app_name_code">Fragments Java Example</string>
+
+    <string name="activity_a_label">Activity A</string>
+    <string name="fragment_a_label">Fragment A</string>
+    <string name="fragment_b_label">Fragment B</string>
+
+    <string name="btn_start_a_label">Start A</string>
+    <string name="btn_start_b_label">Start B</string>
+    <string name="btn_start_c_label">Start C</string>
+    <string name="btn_start_dialog_label">Dialog</string>
+
+    <string name="close">Close</string>
+    <string name="dialog">Dialog</string>
+</resources>
diff --git a/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/ActivityA.java b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/ActivityA.java
new file mode 100644
index 0000000..5210a8a
--- /dev/null
+++ b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/ActivityA.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.basic.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import com.example.com.example.android.basic.fragments.R;
+
+/**
+ * Sample Activity entry point for demonstrating a multi-pane UI using Fragments, assembled
+ * using XML code in the layout file.
+ */
+public class ActivityA extends FragmentActivity {
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_a);
+    }
+}
diff --git a/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/ActivityB.java b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/ActivityB.java
new file mode 100644
index 0000000..8b29dc1
--- /dev/null
+++ b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/ActivityB.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.basic.fragments;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import com.example.com.example.android.basic.fragments.R;
+
+/**
+ * Sample Activity entry point for demonstrating a multi-pane UI using Fragments, assembled
+ * using Java code as an alternative to XML in the layout file.
+ */
+public class ActivityB extends FragmentActivity {
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_b);
+
+        // Create FragmentA and add it to the 'main' FrameLayout
+        FragmentA fragmentA = new FragmentA();
+        fragmentA.setArguments(getIntent().getExtras());
+        getSupportFragmentManager().beginTransaction().add(R.id.main, fragmentA).commit();
+
+        // Create FragmentB, if in landscape orientation, and add it to the 'content' FrameLayout
+        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
+            FragmentB fragmentB = new FragmentB();
+            fragmentB.setArguments(getIntent().getExtras());
+            getSupportFragmentManager().beginTransaction().add(R.id.content, fragmentB).commit();
+        }
+    }
+}
diff --git a/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/FragmentA.java b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/FragmentA.java
new file mode 100644
index 0000000..ccb987c
--- /dev/null
+++ b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/FragmentA.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.basic.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import com.example.com.example.android.basic.fragments.R;
+
+public class FragmentA extends Fragment {
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        // Inflate the layout for this fragment
+        return inflater.inflate(R.layout.fragment_a, container, false);
+    }
+}
diff --git a/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/FragmentB.java b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/FragmentB.java
new file mode 100644
index 0000000..2bae08a
--- /dev/null
+++ b/samples/training/basic/fragment-UI/src/com/example/android/basic/fragments/FragmentB.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.basic.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import com.example.com.example.android.basic.fragments.R;
+
+public class FragmentB extends Fragment {
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        // Inflate the layout for this fragment
+        return inflater.inflate(R.layout.fragment_b, container, false);
+    }
+}