List of usage examples for android.content Intent FLAG_ACTIVITY_NEW_TASK
int FLAG_ACTIVITY_NEW_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_NEW_TASK.
Click Source Link
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 boolean openAppActivity(Context context, String packageName, String activityName) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ComponentName cn = new ComponentName(packageName, activityName); intent.setComponent(cn);//from w ww . j a v a2s . co m try { context.startActivity(intent); return true; } catch (ActivityNotFoundException e) { return false; } }
From source file:Main.java
/** * "Exits" the app to the Home screen"./*from w w w . j av a 2 s . c o m*/ * @param context Application context */ public static void exitToHome(final Context context) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void makeingCalls(Context context, String phoneNum) { if (TextUtils.isEmpty(phoneNum)) { return;//from w ww . j a v a 2 s. com } Intent phoneIntent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + phoneNum)); phoneIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(phoneIntent); }
From source file:Main.java
public static void installApk(Context context, File file) { if (context == null) return;/* www . j av a2 s . c om*/ if (file == null) return; Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void install(Context context, File file) { if (!file.exists()) { return;/*from w w w . j a va 2 s.co m*/ } Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void installApk(Context context, String fileName) { if (fileName != null && fileName.contains(".apk")) { // File f = new File(fileName); // if(f.exists()){ Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.parse("file://" + fileName), "application/vnd.android.package-archive"); context.startActivity(intent);//from ww w. j a v a2s. c o m // } } }
From source file:Main.java
public static void openApplication(final Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage(packageName); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent);/*w w w . jav a 2 s. c o m*/ }
From source file:Main.java
public static void shareToOtherApp(Context context, String title, String content, String dialogTitle) { Intent intentItem = new Intent(Intent.ACTION_SEND); intentItem.setType("text/plain"); intentItem.putExtra(Intent.EXTRA_SUBJECT, title); intentItem.putExtra(Intent.EXTRA_TEXT, content); intentItem.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(Intent.createChooser(intentItem, dialogTitle)); }
From source file:Main.java
/** * use for oepn any url in browser./*from w w w .ja v a2 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); }