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 launchMarket(Context c) { Uri uri = Uri.parse("market://details?id=" + c.getPackageName()); // debug only Uri uri = //Uri.parse("https://market.android.com/details?id=" + getPackageName()); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); try {/*from www .ja v a 2 s . c o m*/ c.startActivity(goToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(c, "XXX" /* R.string.couldnt_launch_market */, Toast.LENGTH_LONG).show(); } }
From source file:Main.java
/** * This method check if an <tt>uri</tt> can be opened by android system. * @param uri the intent uri//from w w w .jav a 2s. com * @param context current context * @return <tt>true</tt> if <tt>uri</tt> can be opened by android system. */ public static boolean canOpenUri(Uri uri, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); PackageManager packageManager = context.getPackageManager(); List<ResolveInfo> resolvedActivities = packageManager.queryIntentActivities(intent, 0); if (resolvedActivities.size() > 0) { return true; } return false; }
From source file:Main.java
/** * send a message to call the emergency with location of the accident * * @param latitude/*from www .j a va 2 s. c o m*/ * @param longitude */ public static void sendEmergencyToMessages(double latitude, double longitude, Context context) { Intent sendSmsIntent = new Intent(Intent.ACTION_VIEW); sendSmsIntent.setData(Uri.parse("sms:")); sendSmsIntent.setType("vnd.android-dir/mms-sms"); String message = "The Car had accident at: " + latitude + " , " + longitude; sendSmsIntent.putExtra(Intent.EXTRA_TEXT, message); if (sendSmsIntent.resolveActivity(context.getPackageManager()) != null) { context.startActivity(sendSmsIntent); } }
From source file:Main.java
/** * Allow to show map//w w w . j a v a2 s. co m */ public static void actionShowMap(Fragment f, String name, String lattitude, String longitude) { final String uri = "geo:0,0?q=" + lattitude + "," + longitude + " (" + name + ")"; f.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri))); }
From source file:Main.java
/** * Wrap an system action intent by the <tt>uri</tt> * @param uri the intent uri/*from www. j ava2 s . com*/ * @return */ public static Intent getIntentOfUri(Uri uri) { return new Intent(Intent.ACTION_VIEW, uri); }
From source file:Main.java
/** Google calendar intent variant 1 */ private static Intent constructGoogleCalendarIntentVariant2() { final Intent intent = new Intent(); // Newer calendar have API for launching the google calendar. See documentation at: // http://developer.android.com/guide/topics/providers/calendar-provider.html#intents final long startTimeMillis = System.currentTimeMillis(); final String url = "content://com.android.calendar/time/" + startTimeMillis; intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(url));//from w ww . j a v a2 s . c om return intent; }
From source file:Main.java
/** * Creates an intent to open either the Play Store or the web page for the play store which will show Parche, * depending on whether the user has the Play Store installed or not. * * @param aContext The current context./*from w ww . j a v a2s. c o m*/ * @return An Intent which can be used to launch the appropriate route to the Play Store. */ //Intent.FLAG_ACTIVITY_CLEAR_TASK_WHEN_RESET deprecated in API 21, but still needed before that. @SuppressWarnings("deprecation") public static Intent showParcheInPlayStoreIntent(Context aContext) { String marketURLString = PLAY_STORE_URL_SCHEME + PARCHE_PACKAGE_NAME; Intent returnIntent; if (urlCanBeHandled(aContext, marketURLString)) { returnIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(marketURLString)); } else { //This user does not have the Play app installed - show them the webpage. String webURLString = PLAY_STORE_WEB_URL + PARCHE_PACKAGE_NAME; returnIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webURLString)); } return returnIntent; }
From source file:Main.java
/** * Checks whether a browser if available on the device to handle ACTION_VIEW intents. * @param ctx The context of the application. * @return Whether ACTION_VIEW intents will resolve. *///from ww w .j av a2 s . c o m public static boolean check_browser_available(Context ctx) { if (_BROWSER_AVAILABLE != null) { return _BROWSER_AVAILABLE; } Intent browser_intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://apktrack.kwiatkowski.fr/")); _BROWSER_AVAILABLE = browser_intent.resolveActivity(ctx.getPackageManager()) != null; return _BROWSER_AVAILABLE; }
From source file:Main.java
/** * Opens market detail application page for donate app * /*from w w w . j a va2 s . c o m*/ * @param context application context */ public static void gotoDonate(Context context) { Intent marketIntent = new Intent(Intent.ACTION_VIEW); marketIntent.setData(Uri.parse("market://details?id=ru.neverdark.phototoolsdonate")); context.startActivity(marketIntent); }
From source file:com.evozi.droidsniff.helper.DialogHelper.java
public static void installBusyBox(Activity context) { DialogHelper.context = context;//from w w w. j av a2s . c om AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(R.string.installbusybox).setCancelable(false) .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent goToMarket = null; goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=stericson.busybox")); DialogHelper.context.startActivity(goToMarket); dialog.cancel(); } }).setNegativeButton(R.string.button_no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }