List of usage examples for android.content Intent setData
public @NonNull Intent setData(@Nullable Uri data)
From source file:Main.java
public static void doIt(Context context, String number) { Intent phoneIntent = new Intent(Intent.ACTION_CALL); phoneIntent.setData(Uri.parse("tel:" + number)); context.startActivity(phoneIntent);// ww w . j a v a 2 s .co m }
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/*from w w w .j ava2 s .c om*/ */ 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
public static void sendEmail(Context context, String receiver) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + receiver)); context.startActivity(intent);//w w w .j a v a2 s. c o m }
From source file:Main.java
public static void uninstallApp(Context context, String appPackageName) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + appPackageName)); context.startActivity(intent);// w w w. java 2 s . com }
From source file:Main.java
public static Intent newEmailIntent(String toAddress, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + Uri.encode(toAddress) + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body) + "&cc=" + Uri.encode(cc))); return intent; }
From source file:Main.java
public static Intent getPhoneIntent() { Intent phoneIntent = new Intent(Intent.ACTION_DIAL); phoneIntent.setData(Uri.parse("tel:+1234567890")); return phoneIntent; }
From source file:Main.java
public static void callPhone(String number, Activity act) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + number)); act.startActivity(callIntent);//from ww w.j a va2 s .c o m }
From source file:Main.java
public static Intent getBrowserIntent(String url) { Intent browserIntent = new Intent(Intent.ACTION_VIEW); browserIntent.setData(Uri.parse(url)); return browserIntent; }
From source file:Main.java
private static Intent getUninstallAppIntent(final String packageName, final boolean isNewTask) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + packageName)); return isNewTask ? intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) : intent; }
From source file:Main.java
/** * Open a webpage with indicated http url * //from w w w . ja v a2s .co m * @param context the application context * @param httpUrl the http url to open */ public static void openWebPage(Context context, String httpUrl) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(httpUrl)); context.startActivity(intent); }