Update to use help APIs.

Change-Id: I11bab7b66376b34303e8e84460236a1ff7a475b2
This commit is contained in:
Dianne Hackborn
2010-12-13 12:46:19 -08:00
parent af2fc1a4e2
commit 11371e6d36
2 changed files with 16 additions and 24 deletions

View File

@@ -5,6 +5,7 @@ import com.example.android.apis.R;
import android.app.Activity;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -36,24 +37,19 @@ public class IntentActivityFlags extends Activity {
*/
//BEGIN_INCLUDE(intent_array)
private Intent[] buildIntentsToViewsLists() {
// We will use FLAG_ACTIVITY_CLEAR_TASK to complete replace our
// current task with a new Intent.
// We are going to rebuild our task with a new back stack. This will
// be done by launching an array of Intents, representing the new
// back stack to be created, with the first entry holding the root
// and requesting to reset the back stack.
Intent[] intents = new Intent[3];
// The main activity started from launcher is action MAIN and
// category LAUNCHER; we want to match that.
// First: root activity of ApiDemos.
// This is a convenient way to make the proper Intent to launch and
// reset an application's task.
intents[0] = Intent.makeRestartActivityTask(new ComponentName(this,
com.example.android.apis.ApiDemos.class));
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
// We will use FLAG_ACTIVITY_CLEAR_TASK to completely replace our
// current task with a new Intent.
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
// Set the actual activity to launch.
intent.setClass(IntentActivityFlags.this, com.example.android.apis.ApiDemos.class);
intents[0] = intent;
intent = new Intent(Intent.ACTION_MAIN);
intent.setClass(IntentActivityFlags.this, com.example.android.apis.ApiDemos.class);
intent.putExtra("com.example.android.apis.Path", "Views");
intents[1] = intent;

View File

@@ -22,6 +22,7 @@ import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
@@ -164,15 +165,10 @@ public class StatusBarNotifications extends Activity {
Intent[] intents = new Intent[4];
// First: root activity of ApiDemos.
// The main activity started from launcher is action MAIN and
// category LAUNCHER; we want to match that.
intents[0] = new Intent(Intent.ACTION_MAIN);
intents[0].addCategory(Intent.CATEGORY_LAUNCHER);
// We will use FLAG_ACTIVITY_CLEAR_TASK to completely replace our
// current task with a new Intent.
intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
intents[0].setClass(this, com.example.android.apis.ApiDemos.class);
// This is a convenient way to make the proper Intent to launch and
// reset an application's task.
intents[0] = Intent.makeRestartActivityTask(new ComponentName(this,
com.example.android.apis.ApiDemos.class));
// "App"
intents[1] = new Intent(this, com.example.android.apis.ApiDemos.class);