List of usage examples for android.content Intent ACTION_VIEW
String ACTION_VIEW
To view the source code for android.content Intent ACTION_VIEW.
Click Source Link
From source file:Main.java
public static void requestGooglePlay(Activity activity, String packageName) { try {//from w ww.ja v a 2s . co m activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName))); } catch (android.content.ActivityNotFoundException anfe) { activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + packageName))); } }
From source file:Main.java
public static void playMedia(Context ctx, String link, String mime) { Uri path = Uri.parse(link);//from ww w . jav a 2s . c o m Intent intent = new Intent(Intent.ACTION_VIEW, path); intent.setDataAndType(path, "video/" + mime); ctx.startActivity(intent); }
From source file:Main.java
public static void playTrailer(Context context, String key) { Intent intent;/*from w w w. j a v a2 s .c o m*/ try { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + key)); context.startActivity(intent); } catch (ActivityNotFoundException ex) { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + key)); context.startActivity(intent); } }
From source file:Main.java
public static void installApk(Context context, File file) { if (!file.exists()) { return;// ww w.j a v a 2s .c o m } Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
private static boolean startBrowserActivity(@NonNull Context context, @NonNull String url) { try {/*from w ww . java2 s . c om*/ Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(it); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
From source file:Main.java
public static void installApkFromLocalPath(Activity activity, String apkname) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(/*from www . j a v a 2s.c o m*/ Uri.parse("file://" + Environment.getExternalStorageDirectory() + "/ewgvip/" + apkname), "application/vnd.android.package-archive"); activity.startActivity(intent); }
From source file:Main.java
public static void openUrl(Context cotx, String url) { Activity act = (Activity) cotx;/*from w w w. ja v a 2 s .com*/ Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); act.startActivity(intent); }
From source file:Main.java
private static void installApk(Context context, Uri uri) { try {//from w ww . ja va 2 s. c om Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "application/vnd.android.package-archive"); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); Toast.makeText(context, "DanaCast is out-dated, please visit http://danacast.me/", Toast.LENGTH_LONG) .show(); } }
From source file:Main.java
public static void installSoftwareByAPK(Context context, String filePath) { Uri uri = Uri.fromFile(new File(filePath)); Intent installIntent = new Intent(Intent.ACTION_VIEW); installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); installIntent.setDataAndType(uri, "application/vnd.android.package-archive"); context.startActivity(installIntent); }
From source file:Main.java
public static boolean installApp(Context context, File apkFile) { try {/*w w w .j a v a 2 s . c o m*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); context.startActivity(intent); return true; } catch (Exception e) { return false; } }