diff --git a/samples/MultiWindow/AndroidManifest.xml b/samples/MultiWindow/AndroidManifest.xml
index 229c48e22..84eb83b03 100644
--- a/samples/MultiWindow/AndroidManifest.xml
+++ b/samples/MultiWindow/AndroidManifest.xml
@@ -26,20 +26,8 @@
-
-
-
-
-
-
-
-
-
+
diff --git a/samples/MultiWindow/res/layout/launching_adjacent_layout.xml b/samples/MultiWindow/res/layout/launching_adjacent_layout.xml
new file mode 100644
index 000000000..3fa6c1c38
--- /dev/null
+++ b/samples/MultiWindow/res/layout/launching_adjacent_layout.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/MultiWindow/res/layout/launching_to_side_layout.xml b/samples/MultiWindow/res/layout/launching_to_side_layout.xml
deleted file mode 100644
index f389d29a2..000000000
--- a/samples/MultiWindow/res/layout/launching_to_side_layout.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/samples/MultiWindow/res/layout/move_task_to_side_layout.xml b/samples/MultiWindow/res/layout/move_task_to_side_layout.xml
deleted file mode 100644
index d2a6c03ee..000000000
--- a/samples/MultiWindow/res/layout/move_task_to_side_layout.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
diff --git a/samples/MultiWindow/res/values/strings.xml b/samples/MultiWindow/res/values/strings.xml
index f36b73c16..56d0e18c5 100644
--- a/samples/MultiWindow/res/values/strings.xml
+++ b/samples/MultiWindow/res/values/strings.xml
@@ -15,9 +15,10 @@
-->
-
Hello, World!
Thanks for All the Fish!
- Launch settings to other side
+ Launch settings adjacent
Launch new task
+ Launch new task adjacent
+ Instance number:
diff --git a/samples/MultiWindow/src/com/example/android/multiwindow/LaunchingAdjacentActivity.java b/samples/MultiWindow/src/com/example/android/multiwindow/LaunchingAdjacentActivity.java
new file mode 100644
index 000000000..1216ff1e0
--- /dev/null
+++ b/samples/MultiWindow/src/com/example/android/multiwindow/LaunchingAdjacentActivity.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2015 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.multiwindow;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+public class LaunchingAdjacentActivity extends Activity implements View.OnClickListener {
+
+ private static final String INSTANCE_NUMBER_KEY = "instance_number";
+
+ private static int mInstanceCount;
+ private int mInstanceNumber;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.launching_adjacent_layout);
+ findViewById(R.id.launch_settings_adjacent).setOnClickListener(this);
+ findViewById(R.id.launch_new_task).setOnClickListener(this);
+ findViewById(R.id.launch_new_task_adjacent).setOnClickListener(this);
+ if (savedInstanceState != null) {
+ mInstanceNumber = savedInstanceState.getInt(INSTANCE_NUMBER_KEY);
+ } else {
+ mInstanceNumber = mInstanceCount++;
+ }
+ ((TextView) findViewById(R.id.instance_number))
+ .setText(getString(R.string.instance_number) + mInstanceNumber);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == R.id.launch_settings_adjacent) {
+ Intent intent = new Intent("android.settings.SETTINGS");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
+ startActivity(intent);
+ } else if (v.getId() == R.id.launch_new_task) {
+ Intent intent = new Intent(this, LaunchingAdjacentActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ } else if (v.getId() == R.id.launch_new_task_adjacent) {
+ Intent intent = new Intent(this, LaunchingAdjacentActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK
+ | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
+ startActivity(intent);
+ }
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle savedInstanceState) {
+ savedInstanceState.putInt(INSTANCE_NUMBER_KEY, mInstanceNumber);
+ super.onSaveInstanceState(savedInstanceState);
+ }
+}
diff --git a/samples/MultiWindow/src/com/example/android/multiwindow/LaunchingToSideActivity.java b/samples/MultiWindow/src/com/example/android/multiwindow/LaunchingToSideActivity.java
deleted file mode 100644
index f94ff570e..000000000
--- a/samples/MultiWindow/src/com/example/android/multiwindow/LaunchingToSideActivity.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2015 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.multiwindow;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-
-public class LaunchingToSideActivity extends Activity implements View.OnClickListener {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.launching_to_side_layout);
- findViewById(R.id.launch_to_the_side).setOnClickListener(this);
- findViewById(R.id.launch_new_task).setOnClickListener(this);
- }
-
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.launch_to_the_side) {
- Intent intent = new Intent("android.settings.SETTINGS");
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
- startActivity(intent);
- } else if (v.getId() == R.id.launch_new_task) {
- Intent intent = new Intent(this, MoveTaskToSideActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
- startActivity(intent);
- }
- }
-}
diff --git a/samples/MultiWindow/src/com/example/android/multiwindow/MoveTaskToSideActivity.java b/samples/MultiWindow/src/com/example/android/multiwindow/MoveTaskToSideActivity.java
deleted file mode 100644
index 90d35525d..000000000
--- a/samples/MultiWindow/src/com/example/android/multiwindow/MoveTaskToSideActivity.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.example.android.multiwindow;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-
-public class MoveTaskToSideActivity extends Activity implements View.OnClickListener {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.move_task_to_side_layout);
- findViewById(R.id.button).setOnClickListener(this);
- }
-
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(this, LaunchingToSideActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
- startActivity(intent);
- }
-}