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.z.stproperty.PropertyDetail.java

/**
 * User can share this property details with their friends through email as well
 * and can choose other options like whats-app, drop-box etc as well
 *//*from w  w w. j ava2 s  .  c om*/
private void shareWithEmail() {
    try {
        String path = Images.Media.insertImage(getContentResolver(), SharedFunction.loadBitmap(shareImageLink),
                "title", null);
        Uri screenshotUri = Uri.parse(path);
        String shareContent = title + "\n\n" + prurl + "\n\n" + price + "\n\n";
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("image/png");
        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "" });
        intent.putExtra(Intent.EXTRA_SUBJECT, "Property to share with you");
        intent.putExtra(Intent.EXTRA_TEXT,
                "I think you might be interested in a property advertised on STProperty \n\n" + shareContent);
        intent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
        SharedFunction.postAnalytics(PropertyDetail.this, "Lead", "Email Share", title);
        startActivity(Intent.createChooser(intent, ""));
    } catch (Exception e) {
        Log.e(this.getClass().getSimpleName(), e.getLocalizedMessage(), e);
    }
}

From source file:com.google.android.apps.paco.FeedbackActivity.java

private void sendEmail(String body, String subject, String userEmail) {
    userEmail = findAccount(userEmail);/*from ww w.ja  va  2  s  .c  o  m*/
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    String aEmailList[] = { userEmail };
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
    emailIntent.setType("plain/text");

    startActivity(emailIntent);
}

From source file:com.mibr.android.intelligentreminder.INeedToo.java

@Override
public Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_REMINDER_CONTACTS_SERVICE_FAILED_LICENSING:
        AlertDialog.Builder buildersvc = new AlertDialog.Builder(this);
        buildersvc.setMessage(/*from ww  w. j a v  a  2s  .com*/
                "The Reminder Contact Service add-on that you've got installed is not a licensed version");
        buildersvc.setCancelable(false)
                .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        String[] mailto = { "info@intelligentreminder.com", "" };
                        Intent sendIntent = new Intent(Intent.ACTION_SEND);
                        sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
                        sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString());
                        sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString());
                        sendIntent.setType("text/plain");
                        startActivity(Intent.createChooser(sendIntent, "Send EMail..."));
                    }
                }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {

                        if (INeedToo.IS_ANDROID_VERSION) {
                            String uri = getString(R.string.indeedtopayforservice);
                            Intent ii3 = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
                            startActivity(ii3);
                        } else {
                            Uri uri = Uri.parse(
                                    "http://www.amazon.com/gp/mas/dl/android?p=com.mibr.android.remindercontacts");
                            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                            startActivity(intent);
                        }

                        isReminderContactsAvailable = true;
                        iDidReminderContacts = false;
                    }
                }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
        AlertDialog alert = buildersvc.create();
        return alert;

    case DOING_SAMPLE_NEEDS_DIALOG:
        if (allItems == null) {
            return null;
        }
        dialogDoingSamples = new Dialog(this);
        dialogDoingSamples.setOwnerActivity(this);
        dialogDoingSamples.setContentView(R.layout.ineedvoiceprogress);
        dialogDoingSamples.setTitle("Working ...");
        ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_cancel)).setEnabled(true);
        ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_ok)).setEnabled(false);
        ;
        //         dialogDoingSamples.show();
        ArrayList stuff = new ArrayList();
        stuff.add(dialogDoingSamples);
        stuff.add(getApplicationContext());
        stuff.add(this);
        stuff.add(getLocationManager());
        stuff.add(getDbAdapter());
        stuff.add(allItems.get(whereImAtInAllItems));
        stuff.add(new Integer(1));
        new NeedByVoiceProgress().execute(stuff);
        return dialogDoingSamples;

    case DIALOG_SAMPLES:
        Dialog aDialog = null;
        AlertDialog.Builder builder2;
        LayoutInflater inflater2 = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout2 = inflater2.inflate(R.layout.ineedsamples, (ViewGroup) findViewById(R.id.hijklmnop));
        builder2 = new AlertDialog.Builder(this);
        builder2.setView(layout2);
        builder2.setTitle("Build Sample Data Set");
        builder2.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                allItems = new ArrayList<ArrayList<String>>();
                Boolean doit = false;
                StringBuilder sb = new StringBuilder();
                StringBuilder sb2 = new StringBuilder();
                StringBuilder sb3 = new StringBuilder();
                int cnt = 0;
                Boolean dw = false;
                ArrayList<String> jdmatchesSS = null;
                ;
                sb.append("I need Print Cartridges description HP 28 and 48 ");
                if (mWalmart != null && mWalmart.isChecked()) {
                    sb.append(" location Walmart ");
                    dw = true;
                }
                if (mWalgreens != null && mWalgreens.isChecked()) {
                    sb.append(" location Walgreens ");
                    dw = true;
                }
                if (dw) { // they checked something
                    doit = true;
                    jdmatchesSS = new ArrayList<String>();
                    jdmatchesSS.add(sb.toString());
                    allItems.add(jdmatchesSS);
                    cnt++;
                }
                if (mSevenEleven != null && mSevenEleven.isChecked()) {
                    sb3.append("I need Energy Drink description Red Bull location 7-Eleven ");
                    ArrayList<String> jdmatches = new ArrayList<String>();
                    jdmatches.add(sb3.toString());
                    allItems.add(jdmatches);
                    cnt++;
                    doit = true;
                }

                if (mStarbucks != null && mStarbucks.isChecked()) {
                    sb2.append("I need Coffee description French Roast location Starbucks");
                    ArrayList<String> jdmatches = new ArrayList<String>();
                    jdmatches.add(sb2.toString());
                    allItems.add(jdmatches);
                    cnt++;
                    doit = true;
                }
                if (doit) {
                    whereImAtInAllItems = 0;
                    INeedToo.this.showDialog(DOING_SAMPLE_NEEDS_DIALOG);
                }

            }
        });
        mWalmart = (CheckBox) layout2.findViewById(R.id.BuildWalmart);
        mWalgreens = (CheckBox) layout2.findViewById(R.id.BuildWalgreens);
        mSevenEleven = (CheckBox) layout2.findViewById(R.id.Build7Eleven);
        mStarbucks = (CheckBox) layout2.findViewById(R.id.BuildStarbucks);

        aDialog = builder2.create();
        return aDialog;

    case DIALOG_SPLASH:
        /*
        jdd=new Dialog(mContext);
        jdd.setContentView(R.layout.ineed2splash);
        jdd.setTitle("W E L C O M E");
        */

        AlertDialog.Builder builder;
        LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.ineed2splashv2,
                (ViewGroup) findViewById(R.id.ScrollView01lmnop2));
        builder = new AlertDialog.Builder(this);

        builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                if (mWantSample != null) {
                    if (mWantSample.isChecked()) {
                        showDialog(DIALOG_SAMPLES);
                    }
                }
            }
        });
        builder.setTitle("W E L C O M E");
        if (getDbAdapter().thereAreSomeLocationsOnSystem()) {
            LinearLayout ll = (LinearLayout) layout.findViewById(R.id.CreateDefaultValues);
            ll.setVisibility(View.INVISIBLE);
        } else {
            mWantSample = (CheckBox) layout.findViewById(R.id.BuildDefaultValues);
        }
        builder.setView(layout);
        jdd = builder.create();
        //Button butt=(Button)jdd.findViewById(R.id.Button01);
        /*butt.setOnClickListener(new View.OnClickListener() {
                   
           @Override
           public void onClick(View v) {
              jdd.cancel();
           }
        });
        */
        break;
    default:
        return null;
    }
    return jdd;

}

From source file:uk.co.tekkies.readings.activity.ReadingsActivity.java

protected void doReportBug() {
    final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType("text/html");
    intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { getString(R.string.bug_email) });
    intent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.bug_subject));
    intent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.bug_content));
    startActivity(Intent.createChooser(intent, getString(R.string.bug_chooser_title)));
}

From source file:net.ddns.mlsoftlaberge.contactslist.ui.ContactAdminFragment.java

public void emailcontact(String email) {
    prepare_invoice();//from w  ww.j av  a 2 s  .  com
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("message/rfc822");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { email });
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Account State");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, noteinvoice.toString());
    try {
        startActivity(Intent.createChooser(emailIntent, "Send Email."));
    } catch (Exception ex) {
        Toast.makeText(getActivity(), "Email Error", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.groksolutions.grok.mobile.GrokActivity.java

/**
 * Send user feedback via email with pre-populated email address, screen capture and optional
 * upload identifier//  w  w  w. j a  v  a  2 s .c om
 * <p/>
 *
 * @param uploadId the identifier of the uploaded information; null if none
 */
protected void emailFeedback(final CharSequence uploadId) {
    Intent feedbackIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    feedbackIntent.putExtra(Intent.EXTRA_EMAIL,
            new String[] { getResources().getText(R.string.feedback_email_address).toString() });
    String subject = getResources().getText(R.string.feedback_email_subject).toString();

    feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    feedbackIntent.setType("message/rfc822");
    ArrayList<Uri> uris = new ArrayList<Uri>();
    uris.add(takeScreenCapture(true));
    if (uploadId != null) {
        uris.add(writeTextFileToSend(uploadId.toString()));
    }
    feedbackIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

    startActivity(Intent.createChooser(feedbackIntent, getResources().getText(R.string.title_feedback)));
}

From source file:com.example.android.recyclingbanks.MainActivity.java

/**
 * composes an email, strictly for email apps.  This version takes no attachments
 *//*from ww w.  j a  v  a  2  s. c  o m*/
public void composeEmail(String[] addresses, String subject) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:")); // only email apps should handle this
    intent.putExtra(Intent.EXTRA_EMAIL, "sam.stratford@gmail.com");//addresses);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}

From source file:de.mprengemann.hwr.timetabel.TimetableActivity.java

private void sendFeedBack() {
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "marcprengemann@web.de" });
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "[Feedback]HWR Berlin Stundenplanapp");

    String myBodyText = "Vorname: \r\n" + "Nachname: \r\n" + "Mailadresse: \r\n" + "Gert: \r\n"
            + "Android-Version: \r\n" + "Fachkombination: \r\n\r\n" + "Bewertung: X von 5 Sternen \r\n"
            + "Bug: \r\n" + "Verbesserungsvorschlge: \r\n\r\n" + "Vielen Dank fr dein Feedback!\r\n"
            + "Marc Prengemann";

    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, myBodyText);
    startActivity(Intent.createChooser(emailIntent, "e-Mail senden ..."));
}

From source file:com.example.android.pharmacyinventory.EditorActivity.java

@Override
public void onLoadFinished(Loader<Cursor> loader, final Cursor cursor) {
    // Bail early if the cursor is null or there is less than 1 row in the cursor
    if (cursor == null || cursor.getCount() < 1) {
        return;/*from   w  ww  .  j  a  va2  s .co  m*/
    }

    // Proceed with moving to the first row of the cursor and reading data from it
    // (This should be the only row in the cursor)
    if (cursor.moveToFirst()) {
        // Find the columns of drug attributes that we're interested in
        int nameColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_NAME);
        int quantityColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_QUANTITY);
        int priceColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_PRICE);
        int imageColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_IMAGE);

        // Extract out the value from the Cursor for the given column index
        String name = cursor.getString(nameColumnIndex);
        int quantity = cursor.getInt(quantityColumnIndex);
        Double price = cursor.getDouble(priceColumnIndex);
        String picture = cursor.getString(imageColumnIndex);

        // Update the views on the screen with the values from the database
        mNameEditText.setText(name);
        mQuantityText.setText(Integer.toString(quantity));
        mPriceEditText.setText(Double.toString(price));
        mDrugImage.setImageURI(Uri.parse(picture));
    }

    orderButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Get the Uri for the current drug
            int IdColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry._ID);
            final long itemId = cursor.getLong(IdColumnIndex);
            Uri mCurrentDrugUri = ContentUris.withAppendedId(DrugContract.DrugEntry.CONTENT_URI, itemId);

            // Find the columns of drug attributes that we're interested in
            int nameColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_NAME);

            // Read the Drug attributes from the Cursor for the current drug
            String name = cursor.getString(nameColumnIndex);

            // Read the drug name to use in subject line
            String subjectLine = "Need to order: " + name;

            Intent intent = new Intent(Intent.ACTION_SENDTO);
            intent.setData(Uri.parse("mailto:")); // only email apps should handle this
            intent.putExtra(Intent.EXTRA_EMAIL, "orders@gmail.com");
            intent.putExtra(Intent.EXTRA_SUBJECT, subjectLine);
            if (intent.resolveActivity(getPackageManager()) != null) {
                startActivity(intent);
            }
        }
    });

}

From source file:org.gnucash.android.export.ExportAsyncTask.java

/**
 * Starts an intent chooser to allow the user to select an activity to receive
 * the exported files./*from   ww w .  j av  a 2 s.c o m*/
 * @param paths list of full paths of the files to send to the activity.
 */
private void shareFiles(List<String> paths) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    shareIntent.setType("text/xml");

    ArrayList<Uri> exportFiles = convertFilePathsToUris(paths);
    shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, exportFiles);
    shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

    shareIntent.putExtra(Intent.EXTRA_SUBJECT,
            mContext.getString(R.string.title_export_email, mExportParams.getExportFormat().name()));

    String defaultEmail = PreferenceManager.getDefaultSharedPreferences(mContext)
            .getString(mContext.getString(R.string.key_default_export_email), null);
    if (defaultEmail != null && defaultEmail.trim().length() > 0)
        shareIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { defaultEmail });

    SimpleDateFormat formatter = (SimpleDateFormat) SimpleDateFormat.getDateTimeInstance();
    ArrayList<CharSequence> extraText = new ArrayList<>();
    extraText.add(mContext.getString(R.string.description_export_email) + " "
            + formatter.format(new Date(System.currentTimeMillis())));
    shareIntent.putExtra(Intent.EXTRA_TEXT, extraText);

    if (mContext instanceof Activity) {
        List<ResolveInfo> activities = mContext.getPackageManager().queryIntentActivities(shareIntent, 0);
        if (activities != null && !activities.isEmpty()) {
            mContext.startActivity(Intent.createChooser(shareIntent,
                    mContext.getString(R.string.title_select_export_destination)));
        } else {
            Toast.makeText(mContext, R.string.toast_no_compatible_apps_to_receive_export, Toast.LENGTH_LONG)
                    .show();
        }
    }
}