List of usage examples for android.content Intent setData
public @NonNull Intent setData(@Nullable Uri data)
From source file:Main.java
public static void call(Activity activity, String mobile) { try {/* w w w . ja v a 2 s . c o m*/ Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + mobile)); activity.startActivity(callIntent); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * This method opens the market with adobe reader for downloading. * /* ww w . j a va 2s . c o m*/ * @param context The context requesting the intent. */ public static void getAdobeReader(Context context) { Intent marketIntent = new Intent(Intent.ACTION_VIEW); marketIntent.setData(Uri.parse("market://details?id=com.adobe.reader")); context.startActivity(marketIntent); }
From source file:Main.java
public static void startURLActivity(Activity context, String strURL) { if (strURL == null) return;/*w w w . j a va 2s.co m*/ if (URLUtil.isValidUrl(strURL) == false) return; Uri url = Uri.parse(strURL); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(url); context.startActivity(i); }
From source file:Main.java
/** * @brief Get the intent to make a call. * * @par Sync (or) Async:/*from w w w .j av a2 s . c o m*/ * This is a Synchronous function. * * @param [IN] telNumber Telephone number.\n * * @return * * @author daiping.zhao * @since 1.0.0.0 * @version 1.0.0.0 * @par Prospective Clients: * External Classes */ public static Intent doCall(String telNumber) { Uri uri = Uri.parse("tel:" + telNumber); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(uri); return intent; }
From source file:Main.java
public static void openView(Context context, String url) { try {// w ww .j a va 2 s . c o m Intent intentUri = new Intent(Intent.ACTION_VIEW); intentUri.setData(Uri.parse(url)); intentUri.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intentUri); } catch (Exception e) { } }
From source file:Main.java
public static void mediaScan(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(uri); context.sendBroadcast(intent);//w w w .j a v a 2 s .c o m }
From source file:Main.java
public static boolean callPhone(Context context, String phone) { try {/*from ww w.ja va 2s . c o m*/ Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + phone)); context.startActivity(callIntent); return true; } catch (ActivityNotFoundException e) { return false; } }
From source file:Main.java
public static void openInBrowser(Activity activity, String link) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_VIEW); sharingIntent.setData(Uri.parse(link)); activity.startActivity(sharingIntent); }
From source file:Main.java
public static void gotoWeb(Context context, String url) { try {/* w w w .j a v a 2s. co m*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND); // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static Intent getEmailIntent(String toEmailAdr, String subject, String message, File attachmentFile, String intentChooserTitle) { String uriText = "mailto:" + toEmailAdr + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(message);/*from w ww . j ava 2 s .c o m*/ Uri uri = Uri.parse(uriText); Intent sendIntent = new Intent(Intent.ACTION_SENDTO); sendIntent.setData(uri); if (attachmentFile != null) sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachmentFile)); return Intent.createChooser(sendIntent, intentChooserTitle); }