Example usage for android.content Intent EXTRA_EMAIL

List of usage examples for android.content Intent EXTRA_EMAIL

Introduction

In this page you can find the example usage for android.content Intent EXTRA_EMAIL.

Prototype

String EXTRA_EMAIL

To view the source code for android.content Intent EXTRA_EMAIL.

Click Source Link

Document

A String[] holding e-mail addresses that should be delivered to.

Usage

From source file:com.lucassaka.botonerags.MainActivity.java

private void sendFeedback() {
    final Intent _Intent = new Intent(android.content.Intent.ACTION_SEND);
    _Intent.setType("text/mail");
    _Intent.putExtra(android.content.Intent.EXTRA_EMAIL,
            new String[] { getString(R.string.mail_feedback_email) });
    _Intent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.mail_feedback_subject));
    startActivity(Intent.createChooser(_Intent, getString(R.string.title_send_feedback)));
}

From source file:com.example.nitish.welcomapp.activitypt.AboutFragment.java

/**
 * Open an email client to send a support request.
 *//*w ww.jav a  2 s  .c  o m*/
private void openEmail() {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.aboutEmail) });
    intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.aboutEmailSubject, BuildConfig.VERSION_NAME));
    if (intent.resolveActivity(getContext().getPackageManager()) != null) {
        startActivity(Intent.createChooser(intent, getString(R.string.aboutSendEmail)));
    } else {
        Toast.makeText(getContext(), R.string.errorNoEmail, Toast.LENGTH_LONG).show();
    }
}

From source file:pw.thedrhax.util.Logger.java

public static void share(Context context) {
    Intent share = new Intent(Intent.ACTION_SEND).setType("text/plain")
            .putExtra(Intent.EXTRA_EMAIL, new String[] { context.getString(R.string.report_email_address) })
            .putExtra(Intent.EXTRA_SUBJECT,
                    context.getString(R.string.report_email_subject, Version.getFormattedVersion()));

    try {/*from  ww w  .  j a v a2 s.  c  o  m*/
        share.putExtra(Intent.EXTRA_STREAM, writeToFile(context));
    } catch (IOException ex) {
        Logger.log(Logger.LEVEL.DEBUG, ex);
        Logger.log(context.getString(R.string.error, context.getString(R.string.error_log_file)));
        share.putExtra(Intent.EXTRA_TEXT, read(Logger.LEVEL.DEBUG));
    }

    context.startActivity(Intent.createChooser(share, context.getString(R.string.report_choose_client)));
}

From source file:com.battlelancer.seriesguide.ui.HelpActivity.java

private void sendEmail() {
    Intent intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType(HTTP.PLAIN_TEXT_TYPE);
    intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { SeriesGuidePreferences.SUPPORT_MAIL });
    intent.putExtra(android.content.Intent.EXTRA_SUBJECT,
            "SeriesGuide " + Utils.getVersion(this) + " Feedback");
    intent.putExtra(android.content.Intent.EXTRA_TEXT, "");

    Intent chooser = Intent.createChooser(intent, getString(R.string.feedback));
    Utils.tryStartActivity(this, chooser, true);
}

From source file:sh.ftp.rocketninelabs.meditationassistant.AboutActivity.java

public void sendMeEmail(View view) {
    Log.d("MeditationAssistant", "Open about");
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("plain/text");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "tslocum@gmail.com" });
    try {/*from   ww w.j  a v  a2 s .c o  m*/
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.appNameShort) + " " + pInfo.versionName + " ("
                + getMeditationAssistant().capitalizeFirst(getMeditationAssistant().getMarketName()) + ")");
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
        intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.appNameShort) + " ("
                + getMeditationAssistant().capitalizeFirst(getMeditationAssistant().getMarketName()) + ")");
    }
    intent.putExtra(android.content.Intent.EXTRA_TEXT, "");

    startActivity(Intent.createChooser(intent, getString(R.string.sendEmail)));
}

From source file:com.njlabs.amrita.aid.about.Amrita.java

public void email_cbe(View view) {
    Intent it = new Intent(Intent.ACTION_SEND);
    it.putExtra(Intent.EXTRA_EMAIL, "mailto:univhq@amrita.edu");
    it.putExtra(Intent.EXTRA_TEXT, "Hi,");
    it.setType("text/plain");
    startActivity(Intent.createChooser(it, "Choose an Email Client"));
}

From source file:com.nogago.android.maps.views.ReviewDialogFragment.java

private void sendReviewMail() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.SUPPORT_MAIL }); //$NON-NLS-1$
    intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$
    intent.putExtra(Intent.EXTRA_SUBJECT, "nogago Maps feature request and feedback"); //$NON-NLS-1$
    StringBuilder text = new StringBuilder();
    text.append(getString(R.string.dlg_review_btn_feature_msg));
    intent.putExtra(Intent.EXTRA_TEXT, text.toString());
    startActivity(Intent.createChooser(intent, getString(R.string.send_report)));
}

From source file:ca.rmen.android.networkmonitor.app.about.AboutActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    case R.id.action_send_logs:
        new AsyncTask<Void, Void, Boolean>() {

            @Override//from   www  .  j a va2  s .c o m
            protected Boolean doInBackground(Void... params) {
                if (!Log.prepareLogFile()) {
                    return false;
                }
                // Bring up the chooser to share the file.
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                //sendIntent.setData(Uri.fromParts("mailto", getString(R.string.send_logs_to), null));
                sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.support_send_debug_logs_subject));
                String messageBody = getString(R.string.support_send_debug_logs_body);
                File f = new File(getExternalFilesDir(null), Log.FILE);
                sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + f.getAbsolutePath()));
                sendIntent.setType("message/rfc822");
                sendIntent.putExtra(Intent.EXTRA_TEXT, messageBody);
                sendIntent.putExtra(Intent.EXTRA_EMAIL,
                        new String[] { getString(R.string.support_send_debug_logs_to) });
                startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.action_share)));
                return true;
            }

            @Override
            protected void onPostExecute(Boolean result) {
                if (!result)
                    Toast.makeText(AboutActivity.this, R.string.support_error, Toast.LENGTH_LONG).show();
            }

        }.execute();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:spit.matrix2017.Fragments.CommitteeFragment.java

@Nullable
@Override/*from   ww  w  .j  a v a 2s.co m*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_committee, container, false);

    secretary = (LinearLayout) view.findViewById(R.id.secretary_email);
    cp = (LinearLayout) view.findViewById(R.id.cp_email);
    vcp = (LinearLayout) view.findViewById(R.id.vcp_email);
    exec = (LinearLayout) view.findViewById(R.id.exec_email);
    tech = (LinearLayout) view.findViewById(R.id.tech_email);
    pr = (LinearLayout) view.findViewById(R.id.pr_email);
    marketing = (LinearLayout) view.findViewById(R.id.marketing_email);
    events = (LinearLayout) view.findViewById(R.id.events_email);
    decor = (LinearLayout) view.findViewById(R.id.decor_email);
    admin = (LinearLayout) view.findViewById(R.id.admin_email);
    security = (LinearLayout) view.findViewById(R.id.security_email);

    View.OnClickListener emailListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String to = "";
            switch (v.getId()) {
            case R.id.secretary_email:
                to = getResources().getString(R.string.secretary_email);
                break;
            case R.id.cp_email:
            case R.id.vcp_email:
                to = getResources().getString(R.string.core_email);
                break;
            case R.id.exec_email:
                to = getResources().getString(R.string.exec_email);
                break;
            case R.id.tech_email:
                to = getResources().getString(R.string.tech_email);
                break;
            case R.id.pr_email:
                to = getResources().getString(R.string.pr_email);
                break;
            case R.id.marketing_email:
                to = getResources().getString(R.string.marketing_email);
                break;
            case R.id.events_email:
                to = getResources().getString(R.string.events_email);
                break;
            case R.id.decor_email:
                to = getResources().getString(R.string.decor_email);
                break;
            case R.id.admin_email:
                to = getResources().getString(R.string.admin_email);
                break;
            case R.id.security_email:
                to = getResources().getString(R.string.security_email);
            }
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SENDTO);
            intent.setType("text/plain");
            intent.setData(Uri.parse("mailto:" + to));
            intent.putExtra(Intent.EXTRA_EMAIL, to);
            try {
                startActivity(Intent.createChooser(intent, "Send Email"));
            } catch (Exception e) {
                Toast.makeText(getActivity(), e.getStackTrace().toString(), Toast.LENGTH_SHORT).show();
            }
        }
    };

    secretary.setOnClickListener(emailListener);
    cp.setOnClickListener(emailListener);
    vcp.setOnClickListener(emailListener);
    exec.setOnClickListener(emailListener);
    tech.setOnClickListener(emailListener);
    pr.setOnClickListener(emailListener);
    marketing.setOnClickListener(emailListener);
    events.setOnClickListener(emailListener);
    decor.setOnClickListener(emailListener);
    admin.setOnClickListener(emailListener);
    security.setOnClickListener(emailListener);

    return view;
}

From source file:com.google.android.apps.mytracks.fragments.ReviewDialogFragment.java

private void sendReviewMail() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.SUPPORT_MAIL }); //$NON-NLS-1$
    intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$
    intent.putExtra(Intent.EXTRA_SUBJECT, "nogago Tracks feature request and feedback"); //$NON-NLS-1$
    StringBuilder text = new StringBuilder();
    text.append(getString(R.string.dlg_review_btn_feature_msg));
    intent.putExtra(Intent.EXTRA_TEXT, text.toString());
    startActivity(Intent.createChooser(intent, getString(R.string.send_report)));
}