diff --git a/samples/training/basic/fragment-UI/AndroidManifest.xml b/samples/training/basic/fragment-UI/AndroidManifest.xml
new file mode 100644
index 000000000..15fb49e02
--- /dev/null
+++ b/samples/training/basic/fragment-UI/AndroidManifest.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 000000000..fd9b97bad
--- /dev/null
+++ b/samples/training/basic/fragment-UI/Basic-activity-class.iml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 000000000..a64b34cb8
--- /dev/null
+++ b/samples/training/basic/fragment-UI/Basic-fragment-class.iml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/training/basic/fragment-UI/ant.properties b/samples/training/basic/fragment-UI/ant.properties
new file mode 100644
index 000000000..ee52d86d9
--- /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 000000000..ee52d86d9
--- /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 000000000..229798406
--- /dev/null
+++ b/samples/training/basic/fragment-UI/build.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/training/basic/fragment-UI/default.properties b/samples/training/basic/fragment-UI/default.properties
new file mode 100644
index 000000000..420db56e3
--- /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 000000000..3d7f8410f
Binary files /dev/null and b/samples/training/basic/fragment-UI/libs/android-support-v13.jar differ
diff --git a/samples/training/basic/fragment-UI/local.properties b/samples/training/basic/fragment-UI/local.properties
new file mode 100644
index 000000000..838a83145
--- /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 000000000..b1cdf17b5
--- /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 ;
+}
+
+-keepclasseswithmembers class * {
+ public (android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+ public (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 000000000..c2368c1e6
--- /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 000000000..6bb06c479
Binary files /dev/null and b/samples/training/basic/fragment-UI/res/drawable-hdpi/ic_launcher.png 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 000000000..70ca1bf45
Binary files /dev/null and b/samples/training/basic/fragment-UI/res/drawable-ldpi/ic_launcher.png 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 000000000..085b783c3
Binary files /dev/null and b/samples/training/basic/fragment-UI/res/drawable-mdpi/ic_launcher.png 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 000000000..bfa4007c0
Binary files /dev/null and b/samples/training/basic/fragment-UI/res/drawable-xhdpi/ic_launcher.png 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 000000000..6638a65f9
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/activity_a.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
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 000000000..9f4ee96bc
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/activity_b.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
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 000000000..60049959d
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/fragment_a.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
\ 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 000000000..eddf15b2d
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-land/fragment_b.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
\ 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 000000000..0f1baa706
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/activity_a.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
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 000000000..8b16e59a2
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/activity_b.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
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 000000000..e3adb86b3
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_a.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
\ 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 000000000..6aa0c323a
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout-xlarge/fragment_b.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
\ 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 000000000..5d6077c8e
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/activity_a.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
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 000000000..03e779c4a
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/activity_b.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
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 000000000..31b0ceb60
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/fragment_a.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
\ 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 000000000..90364d8cd
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/layout/fragment_b.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
\ 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 000000000..9a5607415
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/values/colors.xml
@@ -0,0 +1,27 @@
+
+
+
+ #A8DFF4
+ #D3E992
+ #FFAFAF
+ #FFECC0
+
+ #0099CC
+ #669900
+ #CC0000
+ #FF8A00
+
\ 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 000000000..72ef859fc
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/values/dimensions.xml
@@ -0,0 +1,21 @@
+
+
+
+ 44dp
+ 24dp
+ 10dp
+
\ 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 000000000..9598340fc
--- /dev/null
+++ b/samples/training/basic/fragment-UI/res/values/strings.xml
@@ -0,0 +1,33 @@
+
+
+
+ Dynamic UI Example
+ Fragments XML Example
+ Fragments Java Example
+
+ Activity A
+ Fragment A
+ Fragment B
+
+ Start A
+ Start B
+ Start C
+ Dialog
+
+ Close
+ Dialog
+
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 000000000..5210a8ae5
--- /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 000000000..8b29dc112
--- /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 000000000..ccb987c94
--- /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 000000000..2bae08a15
--- /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);
+ }
+}