summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-26 18:57:13 -0700
committerDianne Hackborn <hackbod@google.com>2012-04-26 18:57:13 -0700
commit9cd165488b9ab08d7fae140e3f13dbceecc9d58b (patch)
tree06f6977f252248d98a160bb67f40487549d5afa3 /samples
parent791babeffccae04aace73fea4b09d59a8e1a0a92 (diff)
downloadandroid_development-9cd165488b9ab08d7fae140e3f13dbceecc9d58b.tar.gz
android_development-9cd165488b9ab08d7fae140e3f13dbceecc9d58b.tar.bz2
android_development-9cd165488b9ab08d7fae140e3f13dbceecc9d58b.zip
Add API demo for Activity.finishAffinity().
Also fix text on some of the existing demos to use the nice larger font. Change-Id: I90d3815cd47cda08217cfc6307d64942f6750ae2
Diffstat (limited to 'samples')
-rw-r--r--samples/ApiDemos/AndroidManifest.xml10
-rw-r--r--samples/ApiDemos/res/layout/activity_animation.xml4
-rw-r--r--samples/ApiDemos/res/layout/activity_finish_affinity.xml45
-rw-r--r--samples/ApiDemos/res/layout/activity_recreate.xml7
-rw-r--r--samples/ApiDemos/res/layout/alarm_controller.xml4
-rw-r--r--samples/ApiDemos/res/layout/alarm_service.xml4
-rw-r--r--samples/ApiDemos/res/layout/foreground_service_controller.xml4
-rw-r--r--samples/ApiDemos/res/layout/forward_target.xml1
-rw-r--r--samples/ApiDemos/res/layout/forwarding.xml4
-rw-r--r--samples/ApiDemos/res/layout/intent_activity_flags.xml4
-rw-r--r--samples/ApiDemos/res/layout/intents.xml4
-rw-r--r--samples/ApiDemos/res/layout/local_sample.xml4
-rw-r--r--samples/ApiDemos/res/layout/local_service_binding.xml4
-rw-r--r--samples/ApiDemos/res/layout/local_service_controller.xml4
-rw-r--r--samples/ApiDemos/res/layout/messenger_service_binding.xml5
-rw-r--r--samples/ApiDemos/res/layout/redirect_enter.xml4
-rw-r--r--samples/ApiDemos/res/layout/redirect_getter.xml7
-rw-r--r--samples/ApiDemos/res/layout/redirect_main.xml8
-rw-r--r--samples/ApiDemos/res/layout/remote_binding_options.xml7
-rw-r--r--samples/ApiDemos/res/layout/remote_service_binding.xml7
-rw-r--r--samples/ApiDemos/res/layout/remote_service_controller.xml4
-rw-r--r--samples/ApiDemos/res/layout/reorder_four.xml4
-rw-r--r--samples/ApiDemos/res/layout/reorder_on_launch.xml4
-rw-r--r--samples/ApiDemos/res/layout/reorder_three.xml4
-rw-r--r--samples/ApiDemos/res/layout/reorder_two.xml4
-rw-r--r--samples/ApiDemos/res/layout/screen_orientation.xml4
-rw-r--r--samples/ApiDemos/res/layout/service_start_arguments_controller.xml4
-rw-r--r--samples/ApiDemos/res/values/strings.xml2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/ActivityRecreate.java3
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FinishAffinity.java62
30 files changed, 176 insertions, 60 deletions
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index cbb5a539b..ebaa67557 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -161,6 +161,16 @@
</intent-filter>
</activity>
+ <activity android:name=".app.FinishAffinity"
+ android:label="@string/activity_finish_affinity"
+ android:taskAffinity=":finishing"
+ android:enabled="@bool/atLeastJellyBean">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".app.SoftInputModes"
android:label="@string/soft_input_modes">
<intent-filter>
diff --git a/samples/ApiDemos/res/layout/activity_animation.xml b/samples/ApiDemos/res/layout/activity_animation.xml
index d789548fd..9d956b52f 100644
--- a/samples/ApiDemos/res/layout/activity_animation.xml
+++ b/samples/ApiDemos/res/layout/activity_animation.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/activity_animation_msg"/>
<Button android:id="@+id/fade_animation"
diff --git a/samples/ApiDemos/res/layout/activity_finish_affinity.xml b/samples/ApiDemos/res/layout/activity_finish_affinity.xml
new file mode 100644
index 000000000..e6954d52c
--- /dev/null
+++ b/samples/ApiDemos/res/layout/activity_finish_affinity.xml
@@ -0,0 +1,45 @@
+<?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:padding="4dip"
+ android:gravity="center_horizontal"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+ <TextView
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="No matter how deep you go, Activity.finishAffinity() will get you back."/>
+
+ <TextView android:id="@+id/seq"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <Button android:id="@+id/nest"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="Nest some more">
+ <requestFocus />
+ </Button>
+
+ <Button android:id="@+id/finish"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="FINISH!">
+ <requestFocus />
+ </Button>
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/activity_recreate.xml b/samples/ApiDemos/res/layout/activity_recreate.xml
index d55dfbded..7a5efcbe4 100644
--- a/samples/ApiDemos/res/layout/activity_recreate.xml
+++ b/samples/ApiDemos/res/layout/activity_recreate.xml
@@ -14,9 +14,6 @@
limitations under the License.
-->
-<!-- Demonstrates starting and stopping a local service.
- See corresponding Java code com.android.sdk.app.LocalSerice.java. -->
-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
@@ -24,8 +21,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/activity_recreate_msg"/>
<Button android:id="@+id/recreate"
diff --git a/samples/ApiDemos/res/layout/alarm_controller.xml b/samples/ApiDemos/res/layout/alarm_controller.xml
index 97ad9f519..0a9d00c1d 100644
--- a/samples/ApiDemos/res/layout/alarm_controller.xml
+++ b/samples/ApiDemos/res/layout/alarm_controller.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/alarm_controller"/>
<Button android:id="@+id/one_shot"
diff --git a/samples/ApiDemos/res/layout/alarm_service.xml b/samples/ApiDemos/res/layout/alarm_service.xml
index e7dac9d4b..bee1a06ba 100644
--- a/samples/ApiDemos/res/layout/alarm_service.xml
+++ b/samples/ApiDemos/res/layout/alarm_service.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/alarm_service"/>
<Button android:id="@+id/start_alarm"
diff --git a/samples/ApiDemos/res/layout/foreground_service_controller.xml b/samples/ApiDemos/res/layout/foreground_service_controller.xml
index 076d4a3dc..77161500d 100644
--- a/samples/ApiDemos/res/layout/foreground_service_controller.xml
+++ b/samples/ApiDemos/res/layout/foreground_service_controller.xml
@@ -24,8 +24,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/foreground_service_controller"/>
<Button android:id="@+id/start_foreground"
diff --git a/samples/ApiDemos/res/layout/forward_target.xml b/samples/ApiDemos/res/layout/forward_target.xml
index b1229553a..d9c65bac9 100644
--- a/samples/ApiDemos/res/layout/forward_target.xml
+++ b/samples/ApiDemos/res/layout/forward_target.xml
@@ -24,6 +24,7 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/forward_target"/>
</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/forwarding.xml b/samples/ApiDemos/res/layout/forwarding.xml
index 6f0d8a80a..e8c5ea4c0 100644
--- a/samples/ApiDemos/res/layout/forwarding.xml
+++ b/samples/ApiDemos/res/layout/forwarding.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/forwarding"/>
<Button android:id="@+id/go"
diff --git a/samples/ApiDemos/res/layout/intent_activity_flags.xml b/samples/ApiDemos/res/layout/intent_activity_flags.xml
index 610e2dd40..79e881a7e 100644
--- a/samples/ApiDemos/res/layout/intent_activity_flags.xml
+++ b/samples/ApiDemos/res/layout/intent_activity_flags.xml
@@ -24,8 +24,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intent_activity_flags"/>
<Button android:id="@+id/flag_activity_clear_task"
diff --git a/samples/ApiDemos/res/layout/intents.xml b/samples/ApiDemos/res/layout/intents.xml
index 553123589..aed709d76 100644
--- a/samples/ApiDemos/res/layout/intents.xml
+++ b/samples/ApiDemos/res/layout/intents.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intents"/>
<Button android:id="@+id/get_music"
diff --git a/samples/ApiDemos/res/layout/local_sample.xml b/samples/ApiDemos/res/layout/local_sample.xml
index 70a9c6b93..4700d5724 100644
--- a/samples/ApiDemos/res/layout/local_sample.xml
+++ b/samples/ApiDemos/res/layout/local_sample.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/local_sample"/>
<Button android:id="@+id/go"
diff --git a/samples/ApiDemos/res/layout/local_service_binding.xml b/samples/ApiDemos/res/layout/local_service_binding.xml
index 6f04ab1f9..71b58721a 100644
--- a/samples/ApiDemos/res/layout/local_service_binding.xml
+++ b/samples/ApiDemos/res/layout/local_service_binding.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/local_service_binding"/>
<Button android:id="@+id/bind"
diff --git a/samples/ApiDemos/res/layout/local_service_controller.xml b/samples/ApiDemos/res/layout/local_service_controller.xml
index 30298d015..4f2aa637d 100644
--- a/samples/ApiDemos/res/layout/local_service_controller.xml
+++ b/samples/ApiDemos/res/layout/local_service_controller.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/local_service_controller"/>
<Button android:id="@+id/start"
diff --git a/samples/ApiDemos/res/layout/messenger_service_binding.xml b/samples/ApiDemos/res/layout/messenger_service_binding.xml
index 23cf63efc..8b6ee2768 100644
--- a/samples/ApiDemos/res/layout/messenger_service_binding.xml
+++ b/samples/ApiDemos/res/layout/messenger_service_binding.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/messenger_service_binding"/>
<Button android:id="@+id/bind"
@@ -41,6 +41,7 @@
<TextView android:id="@+id/callback"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_horizontal" android:paddingTop="4dip"/>
</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/redirect_enter.xml b/samples/ApiDemos/res/layout/redirect_enter.xml
index 6b4493e6e..d1cd4f44c 100644
--- a/samples/ApiDemos/res/layout/redirect_enter.xml
+++ b/samples/ApiDemos/res/layout/redirect_enter.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/redirect_enter"/>
<Button android:id="@+id/go"
diff --git a/samples/ApiDemos/res/layout/redirect_getter.xml b/samples/ApiDemos/res/layout/redirect_getter.xml
index c4e3bd78b..29d633f8f 100644
--- a/samples/ApiDemos/res/layout/redirect_getter.xml
+++ b/samples/ApiDemos/res/layout/redirect_getter.xml
@@ -23,14 +23,13 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/redirect_getter"/>
<EditText android:id="@+id/text"
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip">
+ android:layout_weight="0" android:paddingBottom="4dip">
<requestFocus />
</EditText>
diff --git a/samples/ApiDemos/res/layout/redirect_main.xml b/samples/ApiDemos/res/layout/redirect_main.xml
index a54a9dfe0..697008267 100644
--- a/samples/ApiDemos/res/layout/redirect_main.xml
+++ b/samples/ApiDemos/res/layout/redirect_main.xml
@@ -23,14 +23,14 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/redirect_main"/>
<TextView android:id="@+id/text"
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip" />
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
<Button android:id="@+id/clear"
android:layout_width="wrap_content" android:layout_height="wrap_content"
diff --git a/samples/ApiDemos/res/layout/remote_binding_options.xml b/samples/ApiDemos/res/layout/remote_binding_options.xml
index aec33f83e..b6e4ff546 100644
--- a/samples/ApiDemos/res/layout/remote_binding_options.xml
+++ b/samples/ApiDemos/res/layout/remote_binding_options.xml
@@ -23,14 +23,15 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Demonstrates various options that can be used when binding to a service to modify its process management."/>
<TextView android:id="@+id/callback"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
- android:gravity="center_horizontal" android:paddingBottom="4dip"/>
+ android:gravity="center_horizontal" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
diff --git a/samples/ApiDemos/res/layout/remote_service_binding.xml b/samples/ApiDemos/res/layout/remote_service_binding.xml
index cc408d1b6..1998b1c37 100644
--- a/samples/ApiDemos/res/layout/remote_service_binding.xml
+++ b/samples/ApiDemos/res/layout/remote_service_binding.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/remote_service_binding"/>
<Button android:id="@+id/bind"
@@ -46,7 +46,8 @@
<TextView android:id="@+id/callback"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
- android:gravity="center_horizontal" android:paddingTop="4dip"/>
+ android:gravity="center_horizontal" android:paddingTop="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/remote_service_controller.xml b/samples/ApiDemos/res/layout/remote_service_controller.xml
index 61d770f9c..91535230a 100644
--- a/samples/ApiDemos/res/layout/remote_service_controller.xml
+++ b/samples/ApiDemos/res/layout/remote_service_controller.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/remote_service_controller"/>
<Button android:id="@+id/start"
diff --git a/samples/ApiDemos/res/layout/reorder_four.xml b/samples/ApiDemos/res/layout/reorder_four.xml
index a5c22b5cb..314c269fa 100644
--- a/samples/ApiDemos/res/layout/reorder_four.xml
+++ b/samples/ApiDemos/res/layout/reorder_four.xml
@@ -26,8 +26,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/reorder_four_text"/>
<Button android:id="@+id/reorder_second_to_front"
diff --git a/samples/ApiDemos/res/layout/reorder_on_launch.xml b/samples/ApiDemos/res/layout/reorder_on_launch.xml
index 981b3f475..c4f4957ac 100644
--- a/samples/ApiDemos/res/layout/reorder_on_launch.xml
+++ b/samples/ApiDemos/res/layout/reorder_on_launch.xml
@@ -26,8 +26,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/reorder_on_launch"/>
<Button android:id="@+id/reorder_launch_two"
diff --git a/samples/ApiDemos/res/layout/reorder_three.xml b/samples/ApiDemos/res/layout/reorder_three.xml
index 51a8d0c90..36bf47c94 100644
--- a/samples/ApiDemos/res/layout/reorder_three.xml
+++ b/samples/ApiDemos/res/layout/reorder_three.xml
@@ -26,8 +26,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/reorder_three_text"/>
<Button android:id="@+id/reorder_launch_four"
diff --git a/samples/ApiDemos/res/layout/reorder_two.xml b/samples/ApiDemos/res/layout/reorder_two.xml
index 6fadca0e9..b6f5cbbf2 100644
--- a/samples/ApiDemos/res/layout/reorder_two.xml
+++ b/samples/ApiDemos/res/layout/reorder_two.xml
@@ -26,8 +26,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/reorder_two_text"/>
<Button android:id="@+id/reorder_launch_three"
diff --git a/samples/ApiDemos/res/layout/screen_orientation.xml b/samples/ApiDemos/res/layout/screen_orientation.xml
index b5943e260..8129108a0 100644
--- a/samples/ApiDemos/res/layout/screen_orientation.xml
+++ b/samples/ApiDemos/res/layout/screen_orientation.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/screen_orientation_summary"/>
<Spinner android:id="@+id/orientation"
diff --git a/samples/ApiDemos/res/layout/service_start_arguments_controller.xml b/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
index 556dffc7b..bcf4a65ff 100644
--- a/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
+++ b/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
@@ -23,8 +23,8 @@
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingBottom="4dip"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/service_start_arguments_controller"/>
<Button android:id="@+id/start1"
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index dc7e31284..e716e24b9 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -92,6 +92,8 @@
it reconstructed with significant new changes. In this case the theme is changed.</string>
<string name="recreate">Recreate</string>
+ <string name="activity_finish_affinity">App/Activity/Finish Affinity</string>
+
<string name="activity_receive_result">App/Activity/Receive Result</string>
<string name="pick_result">Pick a result to send, or BACK to cancel.</string>
<string name="corky">Corky</string>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActivityRecreate.java b/samples/ApiDemos/src/com/example/android/apis/app/ActivityRecreate.java
index 4c112b3c4..195835ca0 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ActivityRecreate.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ActivityRecreate.java
@@ -17,12 +17,9 @@
package com.example.android.apis.app;
import com.example.android.apis.R;
-import com.example.android.apis.app.LocalServiceActivities.Controller;
import android.app.Activity;
-import android.content.Intent;
import android.os.Bundle;
-import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FinishAffinity.java b/samples/ApiDemos/src/com/example/android/apis/app/FinishAffinity.java
new file mode 100644
index 000000000..7ae62b6b6
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FinishAffinity.java
@@ -0,0 +1,62 @@
+/*
+ * 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.apis.app;
+
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class FinishAffinity extends Activity {
+ int mNesting;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_finish_affinity);
+
+ mNesting = getIntent().getIntExtra("nesting", 1);
+ ((TextView)findViewById(R.id.seq)).setText("Current nesting: " + mNesting);
+
+ // Watch for button clicks.
+ Button button = (Button)findViewById(R.id.nest);
+ button.setOnClickListener(mNestListener);
+ button = (Button)findViewById(R.id.finish);
+ button.setOnClickListener(mFinishListener);
+ }
+
+ private OnClickListener mNestListener = new OnClickListener() {
+ public void onClick(View v) {
+ Intent intent = new Intent(FinishAffinity.this, FinishAffinity.class);
+ intent.putExtra("nesting", mNesting+1);
+ startActivity(intent);
+ }
+ };
+
+ private OnClickListener mFinishListener = new OnClickListener() {
+ public void onClick(View v) {
+ finishAffinity();
+ }
+ };
+}