List of usage examples for android.content Intent setFlags
public @NonNull Intent setFlags(@Flags int flags)
From source file:Main.java
/** * Goes back to the specific activity if it was already created and clears stack * on top of it/*from www .j av a 2 s .c o m*/ * @param context context to work in * @param activityToGoBack activity class to go back to */ public static void goBackTo(Context context, Class<? extends Activity> activityToGoBack) { Intent intent = new Intent(context, activityToGoBack); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); context.startActivity(intent); }
From source file:Main.java
public static void unInstallApp(Context context, String packageName) { Uri packageUri = Uri.parse("package:" + packageName); Intent intent = new Intent(Intent.ACTION_DELETE, packageUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//w w w . j ava2 s. co m }
From source file:Main.java
/** * use for oepn any url in browser./* w w w . j a v a 2 s .c o m*/ * * @param mContext * @param url to open in your mobile browser */ public static void openURL(Context mContext, String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); }
From source file:Main.java
private static Intent createCalendarIntent(String action) { Intent intent = new Intent(); intent.setAction(action);/*www . j a v a 2 s . c om*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); return intent; }
From source file:Main.java
public static void oepnSetting(Context context) { Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.getApplicationContext().startActivity(intent); }
From source file:Main.java
public static void toScores(Context context) { try {/*from w w w. j a v a2 s . c om*/ Uri uri = Uri.parse("market://details?id=" + context.getPackageName()); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (Exception e) { } }
From source file:Main.java
public static boolean installApk(Context context, String archiveFilePath) { try {//from w ww .ja va 2s.c o m Intent intent = new Intent(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.parse("file:///" + archiveFilePath), "application/vnd.android.package-archive"); context.startActivity(intent); return true; } catch (Exception e) { return false; } }
From source file:Main.java
public static void jumpToSystemSetting(Context context) { Intent intent = new Intent("acton.settings.personal.ServicePhone"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//from w w w . j a va2 s . c o m }
From source file:Main.java
public static void share(Context context, String title, String url) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, url); Intent chooserIntent = Intent.createChooser(shareIntent, title); chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(chooserIntent); }
From source file:Main.java
public static void installApk(Context context, String path) { File file = new File(path); if (file.exists()) { Intent installIntent = new Intent(Intent.ACTION_VIEW); installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); installIntent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(installIntent); }/* w w w . j a va 2 s .c o m*/ }