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.android.shell.BugreportReceiver.java

/**
 * Build {@link Intent} that can be used to share the given bugreport.
 *//*www . ja va 2  s  .c om*/
private static Intent buildSendIntent(Context context, Uri bugreportUri, Uri screenshotUri) {
    final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setType("application/vnd.android.bugreport");

    intent.putExtra(Intent.EXTRA_SUBJECT, bugreportUri.getLastPathSegment());
    intent.putExtra(Intent.EXTRA_TEXT, SystemProperties.get("ro.build.description"));

    final ArrayList<Uri> attachments = Lists.newArrayList(bugreportUri, screenshotUri);
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);

    final Account sendToAccount = findSendToAccount(context);
    if (sendToAccount != null) {
        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { sendToAccount.name });
    }

    return intent;
}

From source file:br.com.PartoHumanizado.fragment.EnviarPlanoDePartoFragment.java

@OnClick(R.id.enviar)
public void enviar() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822");
    //        intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_EMAIL, "");
    intent.putExtra(Intent.EXTRA_SUBJECT, "Plano de Parto");
    intent.putExtra(Intent.EXTRA_TEXT, texto.getText().toString());

    startActivity(Intent.createChooser(intent, "Enviar email"));
    //        startActivity(intent);
}

From source file:ayushi.view.fragment.ContactUsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_about, container, false);

    getActivity().setTitle("Contact Us");

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }/*from  www . j a va  2 s .  com*/

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    mToolbar.setTitleTextColor(Color.WHITE);

    rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });

    rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent callIntent = new Intent(Intent.ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:" + "8888813275"));
            startActivity(callIntent);

        }
    });

    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
    rootView.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {

                Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT,
                        ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP);

            }
            return true;
        }
    });

    rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://hiteshsahu.com/"));
            startActivity(browserIntent);

        }
    });

    rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                    new String[] { "hiteshkumarsahu1990@gmail.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");

            emailIntent.setType("message/rfc822");

            try {
                startActivity(Intent.createChooser(emailIntent, "Send email using..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
            }

        }
    });

    return rootView;
}

From source file:com.hitesh_sahu.retailapp.view.fragment.ContactUsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_about, container, false);

    getActivity().setTitle("Contact Us");

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }//  w w  w.  j a  va  2s  .c om

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    mToolbar.setTitleTextColor(Color.WHITE);

    rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });

    rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent callIntent = new Intent(Intent.ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:" + "8888813275"));
            startActivity(callIntent);

        }
    });

    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
    rootView.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {

                Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT,
                        ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP);

            }
            return true;
        }
    });

    rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://hiteshsahu.com/"));
            startActivity(browserIntent);

        }
    });

    rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "hiteshkrsahu@gmail.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");

            emailIntent.setType("message/rfc822");

            try {
                startActivity(Intent.createChooser(emailIntent, "Send email using..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
            }

        }
    });

    return rootView;
}

From source file:com.oliversride.wordryo.Utils.java

public static void emailAuthor(Context context) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822"); // force email
    intent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.email_author_subject));
    String[] addrs = { context.getString(R.string.email_author_email) };
    intent.putExtra(Intent.EXTRA_EMAIL, addrs);
    String body = format(context, R.string.email_body_revf, GitVersion.VERS);
    intent.putExtra(Intent.EXTRA_TEXT, body);
    String chooserMsg = context.getString(R.string.email_author_chooser);
    context.startActivity(Intent.createChooser(intent, chooserMsg));
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch Email Intent./*from   ww w .jav a2s .c  o m*/
 *
 * @param activity context
 * @param address  to send to
 */
public static void launchEmailIntent(Activity activity, String address) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:"));

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address });
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.Bhailal_Chauhan.retailapp.view.fragment.ContactUsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_about, container, false);

    getActivity().setTitle("Contact Us");

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }//  w  ww.  j av a 2  s.  co m

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    mToolbar.setTitleTextColor(Color.WHITE);

    rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });

    rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent callIntent = new Intent(Intent.ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:" + "8347337366"));
            startActivity(callIntent);

        }
    });

    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
    rootView.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {

                Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT,
                        ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP);

            }
            return true;
        }
    });

    rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://bhailalchauhan.com/"));
            startActivity(browserIntent);

        }
    });

    rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "hibhailal458@gmail.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");

            emailIntent.setType("message/rfc822");

            try {
                startActivity(Intent.createChooser(emailIntent, "Send email using..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
            }

        }
    });

    return rootView;
}

From source file:com.trupti_prajapati.retailapp.view.fragment.ContactUsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_contactus, container, false);

    getActivity().setTitle("Contact Us");

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }/*from   w ww  .j a v  a 2s  . c om*/

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    mToolbar.setTitleTextColor(Color.WHITE);

    rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });

    rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent callIntent = new Intent(Intent.ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:" + "8866685640"));
            startActivity(callIntent);

        }
    });

    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
    rootView.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {

                Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT,
                        ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP);

            }
            return true;
        }
    });

    rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("https://github.com/truptinprajapati"));
            startActivity(browserIntent);

        }
    });

    rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                    new String[] { "truptiprajapati19@gmail.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");

            emailIntent.setType("message/rfc822");

            try {
                startActivity(Intent.createChooser(emailIntent, "Send email using..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
            }

        }
    });

    return rootView;
}

From source file:org.iisgcp.waterwalk.activity.AboutActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setTitle(R.string.title_about);/*from   ww w  . j a v a  2 s .c  o m*/
    setContentView(R.layout.activity_about);

    ActionBar actionBar = this.getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    TextView versionText = (TextView) findViewById(R.id.version_text);
    versionText.setText(getString(R.string.version));

    Button whoAreWeButton = (Button) findViewById(R.id.who_are_we_button);
    whoAreWeButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            String dialogTitle = getString(R.string.who_are_we);
            String dialogText = getString(R.string.who_are_we_text);
            String altDialogText = getString(R.string.alt_who_are_we_text);
            Fragment fragment = PictureInfoDialog.newInstance(AboutActivity.this, dialogTitle, dialogText,
                    altDialogText);
            showDialog(fragment, PICTURE_INFO_DIALOG);
        }

    });

    Button creditsButton = (Button) findViewById(R.id.credits_button);
    creditsButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            String dialogTitle = getString(R.string.credits);
            String dialogText = Html.fromHtml(Utils.getRawString(AboutActivity.this, R.raw.photo_credits))
                    .toString();
            String altDialogText = Html
                    .fromHtml(Utils.getRawString(AboutActivity.this, R.raw.photo_credits_alt)).toString();
            Fragment fragment = InfoDialog.newInstance(AboutActivity.this, dialogTitle, dialogText,
                    altDialogText);
            showDialog(fragment, INFO_DIALOG);
        }

    });

    Button websiteButton = (Button) findViewById(R.id.website_button);
    websiteButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(getString(R.string.website_url)));
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException ex) {

            }
        }

    });

    Button emailUsButton = (Button) findViewById(R.id.email_us_button);
    emailUsButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.contact_email) });
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.contact_subject));
            intent.setType("plain/text");
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException ex) {

            }
        }

    });

    Button copyrightButton = (Button) findViewById(R.id.copyright_button);
    copyrightButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            String dialogTitle = getString(R.string.copyright);
            String dialogText = getString(R.string.university_copyright);
            Fragment fragment = InfoDialog.newInstance(AboutActivity.this, dialogTitle, dialogText);
            showDialog(fragment, INFO_DIALOG);
        }

    });

    Button licenseButton = (Button) findViewById(R.id.license_button);
    licenseButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            String dialogTitle = getString(R.string.licenses);
            String dialogText = "This application uses code from the <a href=\"http://source.android.com\">Android Open Source Project</a> released under the <a href=\"http://www.apache.org/licenses/LICENSE-2.0.html\">Apache License, Version 2.0</a> "
                    + "and <a href=\"https://github.com/nirhart/ParallaxScroll\">ParallaxScroll</a> released under the <a href=\"http://opensource.org/licenses/MIT\">MIT License</a>";
            Fragment fragment = LicenseDialog.newInstance(AboutActivity.this, dialogTitle, dialogText);
            showDialog(fragment, LICENSE_DIALOG);
        }

    });

    Button facebookButton = (Button) findViewById(R.id.facebook_button);
    facebookButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(getString(R.string.facebook_url)));
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException ex) {

            }
        }

    });

    Button twitterButton = (Button) findViewById(R.id.twitter_button);
    twitterButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(getString(R.string.twitter_url)));
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException ex) {

            }
        }

    });
}

From source file:de.atomfrede.android.scc.about.AboutDialogFragment.java

protected void sendFeedbackMail() {
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "atomfrede@gmail.com" });

    startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.about_feedback)));
}