Java Code Examples for android.content.Intent#makeRestartActivityTask()

The following examples show how to use android.content.Intent#makeRestartActivityTask() .
Example 1
Project: Android-utils   File: AppUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Relaunch current app
 */
public static void relaunchApp() {
    Intent i = IntentUtils.getLaunchAppIntent(UtilsApp.getApp().getPackageName(), false);
    if (i == null) return;
    ComponentName cn = i.getComponent();
    Intent ii = Intent.makeRestartActivityTask(cn);
    UtilsApp.getApp().startActivity(ii);
    System.exit(0);
}
 
Example 2
Project: SkyTube   File: SkyTubeApp.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restart the app.
 */
public static void restartApp() {
	Context context = getContext();
	PackageManager packageManager = context.getPackageManager();
	Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName());
	ComponentName componentName = intent.getComponent();
	Intent mainIntent = Intent.makeRestartActivityTask(componentName);
	context.startActivity(mainIntent);
	System.exit(0);
}
 
Example 3
Project: codeexamples-android   File: StatusBarNotifications.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private PendingIntent makeDefaultIntent() {
    // A typical convention for notifications is to launch the user deeply
    // into an application representing the data in the notification; to
    // accomplish this, we can build an array of intents to insert the back
    // stack stack history above the item being displayed.
    Intent[] intents = new Intent[4];

    // 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));

    // "App"
    intents[1] = new Intent(this, com.example.android.apis.ApiDemos.class);
    intents[1].putExtra("com.example.android.apis.Path", "App");
    // "App/Notification"
    intents[2] = new Intent(this, com.example.android.apis.ApiDemos.class);
    intents[2].putExtra("com.example.android.apis.Path", "App/Notification");

    // Now the activity to display to the user.
    intents[3] = new Intent(this, StatusBarNotifications.class);

    // The PendingIntent to launch our activity if the user selects this
    // notification.  Note the use of FLAG_UPDATE_CURRENT so that if there
    // is already an active matching pending intent, we will update its
    // extras (and other Intents in the array) to be the ones passed in here.
    PendingIntent contentIntent = PendingIntent.getActivities(this, 0,
            intents, PendingIntent.FLAG_UPDATE_CURRENT);
    return contentIntent;
}
 
Example 4
Project: MiBandDecompiled   File: j.java    License: Apache License 2.0 4 votes vote down vote up
public static Intent b(ComponentName componentname)
{
    return Intent.makeRestartActivityTask(componentname);
}
 
Example 5
Project: CodenameOne   File: IntentCompatHoneycomb.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
    return Intent.makeRestartActivityTask(mainActivity);
}
 
Example 6
Project: adt-leanback-support   File: IntentCompatHoneycomb.java    License: Apache License 2.0 4 votes vote down vote up
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
    return Intent.makeRestartActivityTask(mainActivity);
}
 
Example 7
Project: V.FlyoutTest   File: IntentCompatHoneycomb.java    License: MIT License 4 votes vote down vote up
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
    return Intent.makeRestartActivityTask(mainActivity);
}
 
Example 8
Project: guideshow   File: IntentCompatHoneycomb.java    License: MIT License 4 votes vote down vote up
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
    return Intent.makeRestartActivityTask(mainActivity);
}