List of usage examples for android.content Intent setData
public @NonNull Intent setData(@Nullable Uri data)
From source file:Main.java
public static Intent getSmsIntent(String number, String body) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("smsto:" + number)); intent.putExtra("sms_body", body); return intent; }
From source file:Main.java
public static void dialNumber(Activity context, String phoneNumber) { if (context == null) { return;/*from ww w . j a v a 2 s . c om*/ } Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phoneNumber)); context.startActivity(intent); }
From source file:Main.java
public static void viewURL(Context context, String url) { Intent viewURLIntent = new Intent(Intent.ACTION_VIEW); viewURLIntent.setData(Uri.parse(url)); context.startActivity(viewURLIntent); }
From source file:Main.java
public static void openLink(Activity activity, String url) { if (url == null) return;/*from w w w. ja v a 2 s. 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 openDeveloperPageOnGooglePlay(Context context, String pubName) { try {/*from ww w .j a v a 2s . c o m*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://search?q=pub:" + pubName)); context.startActivity(intent); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void openApplicationOnGooglePlay(Context context, String packageName) { try {/* ww w .j ava2 s .c o m*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=" + packageName)); context.startActivity(intent); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
/** * Opens the dialer app with my number/*from ww w. j a v a 2s.c om*/ * @param activity the calling activity * @param phoneNumber the phone number to call */ public static void openPhoneDialer(Activity activity, String phoneNumber) { Intent phoneIntent = new Intent(Intent.ACTION_DIAL); phoneIntent.setData(Uri.parse("tel:" + phoneNumber)); activity.startActivity(phoneIntent); }
From source file:Main.java
public static void openLink(Context context, String url) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); i.setData(Uri.parse(url)); context.startActivity(i);/*from www . ja va2 s . c o m*/ }
From source file:Main.java
public static void openUrl(Context context, String url) { if (!url.startsWith("https://") && !url.startsWith("http://")) { url = "http://" + url; }//from w ww . java 2 s.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
public static void unInstallApkFromPackage(Context context, String apk_pkg) { try {/*from ww w .ja va 2 s. co m*/ Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + apk_pkg)); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }