List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_TASK
int FLAG_ACTIVITY_CLEAR_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_TASK.
Click Source Link
From source file:Main.java
static void resolveIntent(Intent intent, Context context) { if (context instanceof Application) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); }/* ww w . ja v a 2s . c om*/ context.startActivity(intent); }
From source file:Main.java
public static void startActivityClearTask(Activity activity, Class<? extends Activity> clazz) { Intent intent = new Intent(activity, clazz); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent);/*w w w.j a v a2 s. c o m*/ activity.overridePendingTransition(0, 0); }
From source file:Main.java
public static Intent getIntent(Context context, Class clazz) { final Intent intent = new Intent(context, clazz); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; }
From source file:Main.java
/** * @param artistName// w w w . ja v a2 s . co m */ public static void shopFor(Context mContext, String artistName) { String str = "https://market.android.com/search?q=%s&c=music&featured=MUSIC_STORE_SEARCH"; Intent shopIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(str, Uri.encode(artistName)))); shopIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shopIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); mContext.startActivity(shopIntent); }
From source file:Main.java
public static void startActivityWithNewTask(@NonNull Context context, @NonNull Class className) { Intent intent = new Intent(context, className); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent);// w w w . jav a2 s. c o m }
From source file:Main.java
public static void newClearTask(Activity activity, Class<?> homeActivityClass) { activity.finish();//from w ww. java 2 s .co m Intent intent = new Intent(activity, homeActivityClass); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent); }
From source file:Main.java
/** * Used to search the Play Store for a specific app. * /*ww w . ja v a2s . c om*/ * @param context The {@link Context} to use. * @param themeName The theme name to search for. */ public static void openAppPage(final Context context, final String themeName) { final Intent shopIntent = new Intent(Intent.ACTION_VIEW); shopIntent.setData(Uri.parse(APP_URI + themeName)); shopIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shopIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(shopIntent); }
From source file:com.common.ui.util.ActivityUtils.java
public static void startActivity(Context context, Class<?> cls) { Intent intent = new Intent(context, cls); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent);// www. j a v a 2s .co m }
From source file:ca.hoogit.powerhour.Notifications.Foreground.java
public static Notification build(Context context, GameModel game) { // Intent for the notification Intent intentMain = new Intent(context, MainActivity.class); intentMain.setAction(Constants.ACTION.MAIN); intentMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent pendingMain = PendingIntent.getActivity(context, 0, intentMain, 0); // Pending intent action to pause the game Intent intentPause = new Intent(context, Engine.class); intentPause.setAction(Constants.ACTION.PAUSE_GAME); PendingIntent pendingPause = PendingIntent.getService(context, 0, intentPause, 0); // Pending intent action to pause the game Intent intentResume = new Intent(context, Engine.class); intentResume.setAction(Constants.ACTION.RESUME_GAME); PendingIntent pendingResume = PendingIntent.getService(context, 0, intentResume, 0); Bitmap icon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher); String contentText = game.minutesRemaining(); NotificationCompat.Action action = new NotificationCompat.Action(R.drawable.ic_stat_av_pause, "Pause", pendingPause);/*w w w. ja v a 2 s .c om*/ if (game.is(State.ACTIVE)) { contentText = "Active with " + contentText; } else if (game.is(State.PAUSED)) { contentText = "Paused with " + contentText; action = new NotificationCompat.Action(R.drawable.ic_stat_av_play_arrow, "Resume", pendingResume); } Notification notification = new NotificationCompat.Builder(context) .setContentTitle(game.options().getTitle() + " - Round " + game.currentRound()) .setTicker(game.options().getTitle() + " - Round " + game.currentRound()) .setContentText(contentText).setSmallIcon(R.drawable.ic_stat_beer) .setLargeIcon(Bitmap.createScaledBitmap(icon, 128, 128, false)).setContentIntent(pendingMain) .setOngoing(true).addAction(action).build(); if (game.is(State.ACTIVE) && !game.canPause()) { notification.actions[0] = new Notification.Action(R.drawable.ic_stat_action_flip_to_front, "Open", pendingMain); } return notification; }
From source file:id.satusatudua.sigap.ui.EscortActivity.java
public static Intent generateIntent(Context context) { Intent intent = new Intent(context, EscortActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; }