Example usage for android.content Intent setFlags

List of usage examples for android.content Intent setFlags

Introduction

In this page you can find the example usage for android.content Intent setFlags.

Prototype

public @NonNull Intent setFlags(@Flags int flags) 

Source Link

Document

Set special flags controlling how this intent is handled.

Usage

From source file:Main.java

public static void openActivityFromHistory(Activity activity, Class<?> pClass) {
    Intent intent = new Intent(activity, pClass);
    intent.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
    activity.startActivity(intent);//  w w  w . ja  v  a  2s .c o m
}

From source file:Main.java

public static void goProgram(Context context, String pkg, String fullclasspath) {
    Intent intent = new Intent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setComponent(new ComponentName(pkg, fullclasspath));
    context.startActivity(intent);/*from www .j a  v a  2  s  .  c o m*/
}

From source file:Main.java

private static Intent getNewStandardIntent(Context packageContext, Class<?> cls) {
    Intent intent = new Intent(packageContext, cls);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    return intent;
}

From source file:Main.java

public static void CloseActivity(Activity activity, Class<?> class1) {
    Intent intent = new Intent(activity, class1);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    activity.startActivity(intent);//from   ww  w. j  a  va2 s.co m
}

From source file:Main.java

public static final void gotoHome(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);//from w ww .  j a v  a2  s . com
}

From source file:Main.java

public static void showDesk(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);//from  ww w .  ja v  a 2  s .  c  o  m
}

From source file:Main.java

public static Intent getHomeIntent() {
    final Intent intent = new Intent("com.announcify");
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    return intent;
}

From source file:Main.java

public static void installApp(Context context, File file) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);/* ww w .  j a  v  a  2s.c  o  m*/
}

From source file:Main.java

public static final Intent getEditorIntent() {
    Uri uri = Uri.parse("market://details?id=net.fhtagn.zoobeditor");
    Intent i = new Intent(Intent.ACTION_VIEW, uri);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return i;/* ww  w. j a v  a2s  .c  o m*/
}

From source file:Main.java

public static void openWebSite(Context context, String url) {
    Uri uri = Uri.parse(url);//w w  w .j  a v a 2s.c  om
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(it);
}