List of usage examples for android.content Intent setData
public @NonNull Intent setData(@Nullable Uri data)
From source file:Main.java
public static Intent getRouteIntent(Uri uri) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(uri); return intent; }
From source file:Main.java
public static Intent getAppDetailsSettingsIntent(String packageName) { Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:" + packageName)); return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); }
From source file:Main.java
/** * Simply opens browser with a regular intent. * /* www.j a va 2 s . com*/ * @param ctx * context to use * @param uri * url top open */ public static void open(final Context ctx, final String uri) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(uri)); ctx.startActivity(intent); }
From source file:Main.java
public static void callPhone(Context context, String number) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_DIAL); intent.setData(Uri.parse(String.format("tel:%s", number))); context.startActivity(intent);/*from ww w .j a v a 2 s . co m*/ }
From source file:Main.java
public static void openBrowser(Context context, String url) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); context.startActivity(intent);/* w ww .j a v a 2 s .c o m*/ }
From source file:Main.java
/** * copy current image to Gallery/*from w w w .j av a 2 s .com*/ */ public static void galleryAddPic(Uri currentImageUri, Activity activity) { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); mediaScanIntent.setData(currentImageUri); activity.sendBroadcast(mediaScanIntent); }
From source file:Main.java
public static void callNum(Context context, String number) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + number)); context.startActivity(intent);/*from w w w . ja v a 2 s . c o m*/ }
From source file:Main.java
public static void callNumWithDial(Context context, String number) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + number)); context.startActivity(intent);/*from w w w. jav a 2 s .co m*/ }
From source file:Main.java
public static void gotoMarket(Context context, String pck) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=" + pck)); context.startActivity(intent);/*from w ww.ja v a 2s .c o m*/ }
From source file:Main.java
public static void callPhone(Context context, String phoneNumber) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + phoneNumber)); context.startActivity(intent);/*from ww w .j a v a2 s . c o m*/ }