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 installApp(Context context, File file) { 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 w ww . j av a 2 s . co m*/ }
From source file:Main.java
public static void openLink(Activity activity, String url) { if (url == null) return;/*from w w w . j ava 2s . co m*/ if (!url.startsWith("http://") && !url.startsWith("https://")) url = "http://" + url; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); intent = Intent.createChooser(intent, null); activity.startActivity(intent); }
From source file:Main.java
public static void toMarket(Context context) { try {/*from w ww . j ava 2s . c o m*/ context.startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName()))); } catch (android.content.ActivityNotFoundException e) { Log.e(TAG, "market can't open " + e); } }
From source file:Main.java
/** * This method opens the market with adobe reader for downloading. * /* w w w .j a v a2s .com*/ * @param context The context requesting the intent. */ public static void getAdobeReader(Context context) { Intent marketIntent = new Intent(Intent.ACTION_VIEW); marketIntent.setData(Uri.parse("market://details?id=com.adobe.reader")); context.startActivity(marketIntent); }
From source file:Main.java
/** * Opens the device's browser to the passed url * @param activity the calling activity/*from www . j a v a 2 s . c om*/ * @param url the url to view */ public static void openBrowser(Activity activity, String url) { final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); activity.startActivity(Intent.createChooser(browserIntent, null)); }
From source file:Main.java
public static void showUCBrowser(Context context, String visitUrl) { Intent intent = new Intent(); intent.setClassName("com.uc.browser", "com.uc.browser.ActivityUpdate"); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse(visitUrl)); context.startActivity(intent);/*from ww w .j a va2s . c om*/ }
From source file:Main.java
public static void inistallSoftware(Context context, String packageName) { String fileName = Environment.getExternalStorageDirectory() + "/" + packageName; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive"); context.startActivity(intent);//from ww w . j a v a2 s . c om }
From source file:Main.java
public static void showQQBrowser(Context context, String visitUrl) { Intent intent = new Intent(); intent.setClassName("com.tencent.mtt", "com.tencent.mtt.MainActivity"); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse(visitUrl)); context.startActivity(intent);/* ww w . jav a 2 s . co m*/ }
From source file:Main.java
public static void showPicture(Context mContext, String imagePath) { File file = new File(imagePath); if (file != null && file.isFile() == true) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "image/*"); mContext.startActivity(intent);/*w w w . jav a 2s . c o m*/ } }
From source file:Main.java
public static void showWebPage(String url, Context context) { if (TextUtils.isEmpty(url)) return;/*from ww w .j a v a 2 s . c o m*/ Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(intent); }