Java Code Examples for android.content.Intent#ACTION_SENDTO
The following examples show how to use
android.content.Intent#ACTION_SENDTO .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ToDay File: AppUtils.java License: MIT License | 6 votes |
public static void sendFeedback(Context callingActivity) { Intent gmailIntent = new Intent(Intent.ACTION_SENDTO); // Hard coding classes is bad.. gmailIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); gmailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { callingActivity.getResources().getString(R.string.email_pressurelabs) }); gmailIntent.putExtra(Intent.EXTRA_SUBJECT, callingActivity.getResources().getString(R.string.feedback_subject_msg)); gmailIntent.putExtra(Intent.EXTRA_TEXT, callingActivity.getResources().getString(R.string.feedback_body_msg)); try { callingActivity.startActivity(gmailIntent); } catch(ActivityNotFoundException ex) { try { callingActivity.startActivity(Intent.createChooser(gmailIntent, "Which app?")); } catch (Exception e) { Toast.makeText(callingActivity, R.string.feedback_failed_msg, Toast.LENGTH_SHORT).show(); } } }
Example 2
Source Project: SocialSdkLibrary File: SmsPlatform.java License: Apache License 2.0 | 6 votes |
@Override protected void dispatchShare(Activity activity, int shareTarget, ShareObj obj) { if (obj.isSms()) { String smsPhone = SocialUtil.notNull(obj.getSmsPhone()); String smsBody = SocialUtil.notNull(obj.getSmsBody()); if (TextUtils.isEmpty(smsPhone)) { onShareFail(SocialError.make("手机号为空")); return; } Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + smsPhone)); intent.putExtra("sms_body", smsBody); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent); onShareSuccess(); } }
Example 3
Source Project: Ticket-Analysis File: PhoneUtils.java License: MIT License | 5 votes |
/** * 发送短信 */ public static void sendSms(Context context, String phoneNumber, String content) { Uri uri = Uri.parse("smsto:" + (TextUtils.isEmpty(phoneNumber) ? "" : phoneNumber)); Intent intent = new Intent(Intent.ACTION_SENDTO, uri); intent.putExtra("sms_body", TextUtils.isEmpty(content) ? "" : content); context.startActivity(intent); }
Example 4
Source Project: Aegis File: AboutActivity.java License: GNU General Public License v3.0 | 5 votes |
private void openMail(String mailaddress) { Intent mailIntent = new Intent(Intent.ACTION_SENDTO); mailIntent.setData(Uri.parse("mailto:" + mailaddress)); mailIntent.putExtra(Intent.EXTRA_EMAIL, mailaddress); mailIntent.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name_full); startActivity(Intent.createChooser(mailIntent, this.getString(R.string.email))); }
Example 5
Source Project: ki4a File: ShowLogActivity.java License: Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: //Let's go back to main Activity dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK)); dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK)); return true; case R.id.refresh_log: log_text.setText(Html.fromHtml(MyLog.dump())); return true; case R.id.copy_log: ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("label", log_text.getText()); clipboard.setPrimaryClip(clip); return true; case R.id.email_log: Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( "mailto","", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Ki4a Application Log"); emailIntent.putExtra(Intent.EXTRA_TEXT, log_text.getText().toString()); startActivity(Intent.createChooser(emailIntent, "Send email...")); default: break; } return super.onOptionsItemSelected(item); }
Example 6
Source Project: OmniList File: IntentUtils.java License: GNU Affero General Public License v3.0 | 5 votes |
public static void sendEmail(Activity context, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + Constants.DEVELOPER_EMAIL)); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); // intent.putExtra(Intent.EXTRA_EMAIL, Constants.DEVELOPER_EMAIL); if (IntentUtils.isAvailable(context, intent, null)) { context.startActivity(intent); } else { ModelHelper.copyToClipboard(context, "mailto:" + Constants.DEVELOPER_EMAIL + "\n" + subject + ":\n" + body); ToastUtils.makeToast(R.string.failed_to_resolve_intent); ToastUtils.makeToast(R.string.content_was_copied_to_clipboard); } }
Example 7
Source Project: framework File: IntentUtils.java License: GNU Affero General Public License v3.0 | 5 votes |
public static void requestMessage(Context context, String email) { if (!email.equals("false") && !email.equals("")) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.setData(Uri.parse("mailto:" + email)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }
Example 8
Source Project: masterpassword File: FeedbackPreference.java License: GNU General Public License v3.0 | 5 votes |
@Override protected void onClick() { DefaultPrefs defaultPrefs = Esperandro.getPreferences(DefaultPrefs.class, getContext()); Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( "mailto", "[email protected]", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Master Password Feedback"); String mailTemplate = "\n\n\n-----\n" + "App Version: %s\n" + "App Version Code: %d\n" + "OS Version: %s\n" + "API Level: %d\n" + "Android Version: %s\n" + "Device Manufacturer: %s\n" + "Device Codename: %s\n" + "Device Model: %s"; String mailText = String.format(mailTemplate, defaultPrefs.versionName(), defaultPrefs.versionCode(), System.getProperty("os.version"), Build.VERSION.SDK_INT, Build.VERSION.RELEASE, Build.MANUFACTURER, Build.DEVICE, Build.MODEL); emailIntent.putExtra(Intent.EXTRA_TEXT, mailText); getContext().startActivity(Intent.createChooser(emailIntent, getContext().getString(R.string.title_feedback))); }
Example 9
Source Project: scallop File: MoreFragment.java License: MIT License | 5 votes |
@OnClick(R.id.feedback_item) public void sendFeedback() { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + Constants.MY_EMAIL)); String emailSubject = context.getResources().getString(R.string.feedback); intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); context.startActivity(intent); }
Example 10
Source Project: BmapLite File: AboutActivity.java License: Apache License 2.0 | 5 votes |
private void sendMail(String mailAddress, String subject) { try { Uri uri = Uri.parse("mailto:" + mailAddress); Intent intent = new Intent(Intent.ACTION_SENDTO, uri); intent.putExtra(Intent.EXTRA_SUBJECT, subject); // 主题 startActivity(Intent.createChooser(intent, "请选择邮件类应用")); } catch (Exception e) { onMessage(mailAddress); e.printStackTrace(); } }
Example 11
Source Project: Shaarlier File: DebugHelper.java License: GNU General Public License v3.0 | 5 votes |
public static void sendMailDev(Activity context, String subject, String content) { Log.d("sendMailDev", content); Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{context.getString(R.string.developer_mail)}); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, content); context.startActivity(intent); }
Example 12
Source Project: pybbsMD File: Navigator.java License: Apache License 2.0 | 5 votes |
public static void openEmail(@NonNull Context context, @NonNull String email, @NonNull String subject, @NonNull String text) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("mailto:" + email)); if (intent.resolveActivity(context.getPackageManager()) != null) { intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, text); context.startActivity(intent); } else { ToastUtils.with(context).show(R.string.no_email_client_install_in_system); } }
Example 13
Source Project: quickhybrid-android File: DeviceUtil.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * 发送消息 * * @param con * @param phonenum * @param body */ public static void sendMsg(Context con, String phonenum, String body) { Uri smsToUri = Uri.parse("smsto:" + phonenum); Intent mIntent = new Intent(Intent.ACTION_SENDTO, smsToUri); mIntent.putExtra("sms_body", body); con.startActivity(mIntent); }
Example 14
Source Project: AdBlockedWebView-Android File: AdBlocksWebViewActivity.java License: MIT License | 4 votes |
@Override public void openEmail(String email) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", email, null)); startActivity(Intent.createChooser(intent, getString(R.string.email))); }
Example 15
Source Project: VinylMusicPlayer File: AboutActivity.java License: GNU General Public License v3.0 | 4 votes |
@Override public void onClick(View v) { if (v == changelog) { ChangelogDialog.create().show(getSupportFragmentManager(), "CHANGELOG_DIALOG"); } else if (v == licenses) { showLicenseDialog(); } else if (v == intro) { startActivity(new Intent(this, AppIntroActivity.class)); } else if (v == forkOnGitHub) { openUrl(GITHUB); } else if (v == visitWebsite) { openUrl(WEBSITE); } else if (v == reportBugs) { startActivity(new Intent(this, BugReportActivity.class)); } else if (v == writeAnEmail) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:[email protected]")); intent.putExtra(Intent.EXTRA_EMAIL, "[email protected]"); intent.putExtra(Intent.EXTRA_SUBJECT, "Vinyl Music Player"); startActivity(Intent.createChooser(intent, "E-Mail")); } else if (v == rateOnGooglePlay) { openUrl(RATE_ON_GOOGLE_PLAY); } else if (v == aidanFollestadGooglePlus) { openUrl(AIDAN_FOLLESTAD_GOOGLE_PLUS); } else if (v == aidanFollestadGitHub) { openUrl(AIDAN_FOLLESTAD_GITHUB); } else if (v == kabouzeidGooglePlus) { openUrl(KABOUZEID_GOOGLE_PLUS); } else if (v == kabouzeidWebsite) { openUrl(KABOUZEID_WEBSITE); } else if (v == michaelCookGooglePlus) { openUrl(MICHAEL_COOK_GOOGLE_PLUS); } else if (v == michaelCookWebsite) { openUrl(MICHAEL_COOK_WEBSITE); } else if (v == maartenCorpelGooglePlus) { openUrl(MAARTEN_CORPEL_GOOGLE_PLUS); } else if (v == aleksandarTesicGooglePlus) { openUrl(ALEKSANDAR_TESIC_GOOGLE_PLUS); } else if (v == eugeneCheungGitHub) { openUrl(EUGENE_CHEUNG_GITHUB); } else if (v == eugeneCheungWebsite) { openUrl(EUGENE_CHEUNG_WEBSITE); } else if (v == adrianTwitter) { openUrl(ADRIAN_TWITTER); } else if (v == adrianWebsite) { openUrl(ADRIAN_WEBSITE); } }
Example 16
Source Project: Awesome-WanAndroid File: ShareUtil.java License: Apache License 2.0 | 4 votes |
public static void sendEmail(Context context, String title) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse( "mailto:" + EMAIL_ADDRESS)); context.startActivity(Intent.createChooser(intent, title)); }
Example 17
Source Project: InstantAppSample File: IntentHelper.java License: Apache License 2.0 | 4 votes |
public static Intent getContactIntent(String contact) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse(MAILTO_URI)); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{contact}); return intent; }
Example 18
Source Project: actor-platform File: InviteFragment.java License: GNU Affero General Public License v3.0 | 4 votes |
private void sendEmailInvites(String emailsString, String inviteMessage) { Uri emailsToUri = Uri.parse("mailto:" + emailsString); Intent i = new Intent(Intent.ACTION_SENDTO, emailsToUri); i.putExtra(Intent.EXTRA_TEXT, inviteMessage); startActivity(Intent.createChooser(i, getString(R.string.contacts_invite_via_link))); }
Example 19
Source Project: Loop File: EmailUtility.java License: Apache License 2.0 | 3 votes |
public static Intent getEmailIntent(Context context) { final Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")); String bodyText = getEmailBody(context); String emailAddy = context.getResources().getString(R.string.support_email); String subject = context.getResources().getString(R.string.email_subject); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddy}); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, bodyText); return intent; }
Example 20
Source Project: Android-utils File: IntentUtils.java License: Apache License 2.0 | 3 votes |
/** * 返回一个用来发送邮件的意图 * * @param emailAddress 目标邮箱地址 * @param subject 邮件主题 * @param body 邮件正文 * @param isNewTask 是否作为 NEW TASK 启动指定的应用 * @return 意图 */ public static Intent getSendEmailIntent(final String emailAddress, final String subject, final String body, final boolean isNewTask) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + emailAddress)); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); intent.putExtra(Intent.EXTRA_EMAIL, emailAddress); return getIntent(intent, isNewTask); }