List of usage examples for android.content Intent EXTRA_EMAIL
String EXTRA_EMAIL
To view the source code for android.content Intent EXTRA_EMAIL.
Click Source Link
From source file:liqui.droid.activity.Base.java
/** * Open feedback dialog.//w w w . j av a 2s . c om */ public void openFeedbackDialog() { Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dlg_feedback); dialog.setTitle(getResources().getString(R.string.feedback)); Button btnByEmail = (Button) dialog.findViewById(R.id.btn_by_email); btnByEmail.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getResources().getString(R.string.my_email) }); sendIntent.setType("message/rfc822"); startActivity(Intent.createChooser(sendIntent, "Select email application.")); } }); dialog.show(); }
From source file:com.idevity.card.read.ReadMain.java
private void shareData() { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("message/rfc822"); String mail = g.getLogData(); Calendar now = Calendar.getInstance(); String[] defEmail = { this.sharedPref.getString(g.getDefaultEmail(), "") }; String shareSubject = "IDevity ID One Reader Log (Android) - " + now.getTime().toString(); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, shareSubject); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, mail); sharingIntent.putExtra(android.content.Intent.EXTRA_EMAIL, defEmail); startActivity(Intent.createChooser(sharingIntent, "Share Via...")); }
From source file:com.hijacker.SendLogActivity.java
public void onUseEmail(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("plain/text"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "kiriakopoulos44@gmail.com" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Hijacker bug report"); Uri attachment = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", report); intent.putExtra(Intent.EXTRA_STREAM, attachment); intent.putExtra(Intent.EXTRA_TEXT, extraView.getText().toString()); startActivity(intent);/*from w w w . j a v a2 s.com*/ }
From source file:com.cw.litenote.operation.mail.MailPagesFragment.java
void sendEMail(String strEMailAddr, // eMail address String[] attachmentFileName, // attachment name String[] picFileNameArray) // attachment picture file name { mAttachmentFileName = attachmentFileName; // new ACTION_SEND intent mEMailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); // for multiple attachments // set type//from www. j av a 2 s . c o m mEMailIntent.setType("text/plain");//can select which APP will be used to send mail // open issue: cause warning for Key android.intent.extra.TEXT expected ArrayList String text_body = mContext.getResources().getString(R.string.eMail_body)// eMail text (body) + " " + Util.getStorageDirName(mContext) + " (UTF-8)" + Util.NEW_LINE + mEMailBodyString; // attachment: message List<String> filePaths = new ArrayList<String>(); for (int i = 0; i < attachmentFileName.length; i++) { String messagePath = "file:///" + Environment.getExternalStorageDirectory().getPath() + "/" + Util.getStorageDirName(mContext) + "/" + attachmentFileName[i];// message file name filePaths.add(messagePath); } // attachment: pictures if (picFileNameArray != null) { for (int i = 0; i < picFileNameArray.length; i++) { filePaths.add(picFileNameArray[i]); } } ArrayList<Uri> uris = new ArrayList<Uri>(); for (String file : filePaths) { Uri uri = Uri.parse(file); uris.add(uri); } mEMailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { strEMailAddr }) // eMail address .putExtra(Intent.EXTRA_SUBJECT, Util.getStorageDirName(mContext) + // eMail subject " " + mContext.getResources().getString(R.string.eMail_subject))// eMail subject .putExtra(Intent.EXTRA_TEXT, text_body) // eMail body (open issue) .putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); // multiple eMail attachment Log.v(getClass().getSimpleName(), "attachment " + Uri.parse("file name is:" + attachmentFileName)); getActivity().startActivityForResult( Intent.createChooser(mEMailIntent, getResources().getText(R.string.mail_chooser_title)), EMAIL_PAGES); }
From source file:io.nuclei.cyto.share.PackageTargetManager.java
/** * Set default intent data//from ww w . ja v a2 s . com */ protected void onSetDefault(Context context, String packageName, String authority, Intent intent, String text) { intent.putExtra(Intent.EXTRA_TEXT, text); if (!TextUtils.isEmpty(mSubject)) intent.putExtra(Intent.EXTRA_SUBJECT, mSubject); if (mUri != null || mFile != null) { Uri uri = mUri; String type = "*/*"; if (mFile != null) { uri = FileProvider.getUriForFile(context, authority, mFile); final int lastDot = mFile.getName().lastIndexOf('.'); if (lastDot >= 0) { String extension = mFile.getName().substring(lastDot + 1); String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); if (mimeType != null) type = mimeType; } } intent.setDataAndType(intent.getData(), type); intent.putExtra(Intent.EXTRA_STREAM, uri); if (packageName != null) { intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); context.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); } } else { intent.setType("text/plain"); } if (!TextUtils.isEmpty(mEmail)) { intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mEmail }); intent.setData(Uri.parse("mailto:")); } }
From source file:com.example.nwilde.myfirstapp.settingsactivity.SettingsFragment.java
private void sendEmail() { Intent emailIntent = new Intent(Intent.ACTION_SEND); // The intent does not have a URI, so declare the "text/plain" MIME type emailIntent.setType(PLAIN_TEXT_TYPE); // recipients emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getResources().getString(R.string.pref_feedback_recipient) }); String subject = getResources().getString(R.string.app_name) + " - v" + getResources().getString(R.string.versionName); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); String message = getResources().getString(R.string.pref_feedback_message); emailIntent.putExtra(Intent.EXTRA_TEXT, message); startActivity(emailIntent);/*from w w w . j a v a2 s . c o m*/ }
From source file:ai.api.sample.MainActivity.java
public synchronized void createCalendarEvent() { Calendar beginTime = Calendar.getInstance(); beginTime.set(2017, 4, 6, 10, 15);/*from ww w .ja va2s. c o m*/ Calendar endTime = Calendar.getInstance(); endTime.set(2017, 4, 6, 10, 30); Intent intent = new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis()) .putExtra(CalendarContract.Events.TITLE, "Reminder") .putExtra(CalendarContract.Events.DESCRIPTION, "Group class") .putExtra(CalendarContract.Events.EVENT_LOCATION, "The gym") .putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY) .putExtra(Intent.EXTRA_EMAIL, "15.amangupta@gmail.com"); startActivity(intent); }
From source file:de.geeksfactory.opacclient.frontend.AccountFragment.java
@Override public void accountSelected(Account account) { svAccount.setVisibility(View.GONE); unsupportedErrorView.setVisibility(View.GONE); answerErrorView.setVisibility(View.GONE); errorView.removeAllViews();// w w w . j a v a2 s .c o m llLoading.setVisibility(View.VISIBLE); setRefreshing(false); supported = true; this.account = app.getAccount(); OpacApi api; try { api = app.getApi(); } catch (NullPointerException e) { e.printStackTrace(); return; } if (api != null && !app.getLibrary().isAccountSupported()) { supported = false; // Not supported with this api at all llLoading.setVisibility(View.GONE); unsupportedErrorView.setVisibility(View.VISIBLE); tvErrBodyU.setText(R.string.account_unsupported_api); btSend.setText(R.string.write_mail); btSend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "info@opacapp.de" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Bibliothek " + app.getLibrary().getIdent()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.interested_to_help)); emailIntent.setType("text/plain"); startActivity(Intent.createChooser(emailIntent, getString(R.string.write_mail))); } }); } else if (account.getPassword() == null || account.getPassword().equals("null") || account.getPassword().equals("") || account.getName() == null || account.getName().equals("null") || account.getName().equals("")) { // No credentials entered llLoading.setVisibility(View.GONE); answerErrorView.setVisibility(View.VISIBLE); btPrefs.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), AccountEditActivity.class); intent.putExtra(AccountEditActivity.EXTRA_ACCOUNT_ID, app.getAccount().getId()); startActivity(intent); } }); tvErrHeadA.setText(""); tvErrBodyA.setText(R.string.status_nouser); } else { // Supported Context ctx = getActivity() != null ? getActivity() : OpacClient.getEmergencyContext(); AccountDataSource adatasource = new AccountDataSource(ctx); adatasource.open(); refreshtime = adatasource.getCachedAccountDataTime(account); if (refreshtime > 0) { displaydata(adatasource.getCachedAccountData(account), true); if (System.currentTimeMillis() - refreshtime > MAX_CACHE_AGE) { refresh(); } } else { refresh(); } adatasource.close(); } }
From source file:com.example.android.naradaonline.DatagramFragment.java
protected final void sendEmail(DatagramRequest data) { if (data.type != DatagramRequestType.SEND_EMAIL) { Log.w(TAG, "This datagram is actually of type " + data.type.name()); }/* w w w. j av a 2 s .com*/ Log.i("Send email", ""); String[] TO = { data.mEmailTo }; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, TO); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your Datagram"); emailIntent.putExtra(Intent.EXTRA_TEXT, data.mEmailBody); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); Log.i("Finished sending email...", ""); } catch (android.content.ActivityNotFoundException ex) { // Toast.makeText(MainActivity.this, // "There is no email client installed.", Toast.LENGTH_SHORT).show(); } }
From source file:nuclei.ui.share.PackageTargetManager.java
/** * Set default intent data/* w ww . j a va 2 s .c o m*/ */ protected void onSetDefault(Context context, String packageName, String authority, Intent intent, String text) { intent.putExtra(Intent.EXTRA_TEXT, text); if (!TextUtils.isEmpty(mSubject)) intent.putExtra(Intent.EXTRA_SUBJECT, mSubject); onSetFileProvider(context, packageName, authority, intent); if (!TextUtils.isEmpty(mEmail)) { intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mEmail }); intent.setData(Uri.parse("mailto:")); } else if (!TextUtils.isEmpty(mSms)) { //if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { intent.putExtra("sms_body", text); intent.putExtra("address", mSms); intent.putExtra(Intent.EXTRA_PHONE_NUMBER, new String[] { mSms }); //} intent.setData(Uri.parse("smsto:" + mSms)); } }