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 toScores(Context context) { try {// ww w . j a v a 2s.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
/** ----------------------------------------------------------------------- Google Maps -- */ public static Intent newOpenMapsAtLatLongAndName(String latitude, String longitude, String name) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(Locale.ENGLISH, "geo:%s,%s", latitude, longitude) + "?q=" + Uri.encode(latitude + "," + longitude + "(" + name + ")") + "&z=16")); intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); return intent; }
From source file:Main.java
/** * @param activity// w ww. j a v a 2s.c o m * @param phone */ public static void phone(Activity activity, String phone) { phone = "tel:" + phone.trim(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(phone)); activity.startActivity(intent); }
From source file:Main.java
/** * Returns an intent designated for the play store page for this application. * @param packageName - Package name of the application. * @return// w w w .java 2 s. c o m */ public static Intent getPlayStoreIntent(String packageName) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=" + packageName)); return intent; }
From source file:Main.java
/** * Install apk// w w w .j av a2s . co m */ public static void installApk(Context context, File file) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_DEFAULT); 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
/** * Deprecated, use {@link norg.javiki.IntentBuilder.buildAppInstallIntent} instead * @param filePath/*from www. j av a2 s. c o m*/ * @return */ @Deprecated public static Intent buildAppInstallIntent(File filePath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(filePath), "application/vnd.android.package-archive"); return intent; }
From source file:Main.java
public static void openPlayStore(Context context) { final String appPackageName = context.getPackageName(); try {// w w w . ja v a 2 s . c o m context.startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } }
From source file:Main.java
public static void openUrl(Context context, String url) { if (!url.startsWith("https://") && !url.startsWith("http://")) { url = "http://" + url; }/*from ww w . j a v a 2s . c o m*/ Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Log.d("WipiwayController", "openUrl . Openning link - " + url); context.startActivity(i); }
From source file:Main.java
/** * @param artistName//from w w w.j av a 2 s . co m */ public static void shopFor(Context mContext, String artistName) { String str = "https://market.android.com/search?q=%s&c=music&featured=MUSIC_STORE_SEARCH"; Intent shopIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(str, Uri.encode(artistName)))); shopIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shopIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); mContext.startActivity(shopIntent); }
From source file:Main.java
public static boolean installApk(Context context, String fileName) { File apkfile = new File(fileName); if (!apkfile.exists()) { return false; }//from w w w.j av a 2 s. c om Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + apkfile.toString()), "application/vnd.android.package-archive"); context.startActivity(intent); return true; }