Example usage for android.content Intent EXTRA_SUBJECT

List of usage examples for android.content Intent EXTRA_SUBJECT

Introduction

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

Prototype

String EXTRA_SUBJECT

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

Click Source Link

Document

A constant string holding the desired subject line of a message.

Usage

From source file:com.cmput301.recipebot.ui.AbstractRecipeActivity.java

/**
 * Creates a sharing {@link android.content.Intent}.
 * Shares mRecipe, doesn't get it from the UI.
 *
 * @return The sharing intent./*from w w w  .ja v a  2 s .c  om*/
 */
private static Intent createShareIntent(Recipe recipe, File file) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, recipe.getName());
    shareIntent.putExtra(Intent.EXTRA_TITLE, recipe.getName());
    shareIntent.putExtra(Intent.EXTRA_TEXT, recipe.toEmail());
    shareIntent.setType("application/json");
    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
    return shareIntent;
}

From source file:com.codebutler.farebot.activities.AdvancedCardInfoActivity.java

private void reportError() {
    DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
        @Override/* w ww.  j  a va  2 s. co  m*/
        public void onClick(DialogInterface dialog, int which) {
            StringBuilder builder = new StringBuilder();
            builder.append(Utils.getDeviceInfoString());
            builder.append("\n\n");

            builder.append(mError.toString());
            builder.append("\n");
            builder.append(Utils.getErrorMessage(mError));
            builder.append("\n");
            for (StackTraceElement elem : mError.getStackTrace()) {
                builder.append(elem.toString());
                builder.append("\n");
            }

            builder.append("\n\n");

            try {
                builder.append(Utils.xmlNodeToString(mCard.toXML().getOwnerDocument()));
            } catch (Exception ex) {
                builder.append("Failed to generate XML: ");
                builder.append(ex);
            }

            builder.append("\n\n");
            builder.append(getString(R.string.comments));
            builder.append(":\n\n");

            Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:eric+farebot@codebutler.com"));
            intent.putExtra(Intent.EXTRA_SUBJECT, "FareBot Bug Report");
            intent.putExtra(Intent.EXTRA_TEXT, builder.toString());
            startActivity(intent);

        }
    };
    new AlertDialog.Builder(this).setTitle(R.string.report_error_privacy_title)
            .setMessage(R.string.report_error_privacy_message).setPositiveButton(android.R.string.ok, listener)
            .setNegativeButton(android.R.string.cancel, null).show();
}

From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.OrgDetail.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.org_export) {
        if (this.org == null)
            return false;

        if (!this.org.verifySignature()) {
            Toast.makeText(this, "Bad Signature", Toast.LENGTH_SHORT).show();
            Log.d("ORG", "Bad signature: " + this.org);
            return false;
        }/*from w  ww. j a va2s  . c o  m*/

        DD_SK sk = new DD_SK();
        sk.org.add(org);
        net.ddp2p.common.data.D_Peer creator = org.getCreator();
        if (creator != null)
            sk.peer.add(creator);

        String testText = DD.getExportTextObjectBody(sk.encode()); // "something";
        String testSubject = DD.getExportTextObjectTitle(this.org); //"subject";

        /*         if (organization_gidh == null) {
                    Toast.makeText(this, "No peer. Reload!", Toast.LENGTH_SHORT).show();
                    return true;
                 }*/
        //DD_Address adr = new DD_Address();

        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_TEXT, testText);
        i.putExtra(Intent.EXTRA_SUBJECT, testSubject);// "DDP2P: Organization Address of \""+ testSubject);
        i = Intent.createChooser(i, "Send Organization");
        startActivity(i);
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.jlcsoftware.callrecorder.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        Intent intent = new Intent(this, SettingsActivity.class);
        startActivity(intent);/*from  w  ww  .j a  v a 2 s.  c  o m*/
        return true;
    }

    if (id == R.id.action_save) {
        if (null != selectedItems && selectedItems.length > 0) {
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    for (PhoneCallRecord record : selectedItems) {
                        record.getPhoneCall().setKept(true);
                        record.getPhoneCall().save(MainActivity.this);
                    }
                    LocalBroadcastManager.getInstance(MainActivity.this)
                            .sendBroadcast(new Intent(LocalBroadcastActions.NEW_RECORDING_BROADCAST)); // Causes refresh

                }
            };
            handler.post(runnable);
        }
        return true;
    }

    if (id == R.id.action_share) {
        if (null != selectedItems && selectedItems.length > 0) {
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    ArrayList<Uri> fileUris = new ArrayList<Uri>();
                    for (PhoneCallRecord record : selectedItems) {
                        fileUris.add(Uri.fromFile(new File(record.getPhoneCall().getPathToRecording())));
                    }
                    Intent shareIntent = new Intent();
                    shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
                    shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, fileUris);
                    shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_title));
                    shareIntent.putExtra(Intent.EXTRA_HTML_TEXT,
                            Html.fromHtml(getString(R.string.email_body_html)));
                    shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.email_body));
                    shareIntent.setType("audio/*");
                    startActivity(Intent.createChooser(shareIntent, getString(R.string.action_share)));
                }
            };
            handler.post(runnable);
        }
        return true;
    }

    if (id == R.id.action_delete) {
        if (null != selectedItems && selectedItems.length > 0) {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.setTitle(R.string.delete_recording_title);
            alert.setMessage(R.string.delete_recording_subject);
            alert.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {

                    Runnable runnable = new Runnable() {
                        @Override
                        public void run() {
                            Database callLog = Database.getInstance(MainActivity.this);
                            for (PhoneCallRecord record : selectedItems) {
                                int id = record.getPhoneCall().getId();
                                callLog.removeCall(id);
                            }

                            LocalBroadcastManager.getInstance(MainActivity.this).sendBroadcast(
                                    new Intent(LocalBroadcastActions.RECORDING_DELETED_BROADCAST));
                        }
                    };
                    handler.post(runnable);

                    dialog.dismiss();

                }
            });
            alert.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {

                    dialog.dismiss();
                }
            });

            alert.show();
        }
        return true;
    }

    if (id == R.id.action_delete_all) {

        AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle(R.string.delete_recording_title);
        alert.setMessage(R.string.delete_all_recording_subject);
        alert.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {

                Runnable runnable = new Runnable() {
                    @Override
                    public void run() {
                        Database.getInstance(MainActivity.this).removeAllCalls(false);
                        LocalBroadcastManager.getInstance(getApplicationContext())
                                .sendBroadcast(new Intent(LocalBroadcastActions.RECORDING_DELETED_BROADCAST));
                    }
                };
                handler.post(runnable);

                dialog.dismiss();

            }
        });
        alert.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {

                dialog.dismiss();
            }
        });

        alert.show();

        return true;
    }

    if (R.id.action_whitelist == id) {
        if (permissionReadContacts) {
            Intent intent = new Intent(this, WhitelistActivity.class);
            startActivity(intent);
        } else {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.setTitle(R.string.permission_whitelist_title);
            alert.setMessage(R.string.permission_whitelist);
        }
        return true;
    }
    if (R.id.action_about == id) {
        AboutDialog.show(this);
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.code.android.vibevault.FeaturedShowsScreen.java

/** Handle user's long-click selection.
*
*//*w  w  w  . ja va2  s  .c o  m*/
@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
    if (menuInfo != null) {
        ArchiveShowObj selShow = (ArchiveShowObj) featuredShowsList.getAdapter().getItem(menuInfo.position);
        switch (item.getItemId()) {
        case VibeVault.EMAIL_LINK:
            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("plain/text");
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                    "Great show on archive.org: " + selShow.getArtistAndTitle());
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                    "Hey,\n\nYou should listen to " + selShow.getArtistAndTitle() + ".  You can find it here: "
                            + selShow.getShowURL() + "\n\nSent using VibeVault for Android.");
            startActivity(Intent.createChooser(emailIntent, "Send mail..."));
            return true;
        case (VibeVault.ADD_TO_FAVORITE_LIST):
            VibeVault.db.insertFavoriteShow(selShow);
            return true;
        default:
            break;
        }
        return false;
    }
    return true;
}

From source file:com.christophergs.mbientbasic.SensorFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (sensorResId != 2131165359) {
        chart = (LineChart) view.findViewById(R.id.data_chart);

        initializeChart();/*  w ww  .  j  a v  a2  s.co m*/
        resetData(false);
        chart.invalidate();
        chart.setDescription(null);

        Button clearButton = (Button) view.findViewById(R.id.layout_two_button_left);
        clearButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                refreshChart(true);
            }
        });
        clearButton.setText(R.string.label_clear);
    } else {
        Log.i(TAG, "Pie Chart");
    }

    ((Switch) view.findViewById(R.id.sample_control))
            .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                    if (b) {
                        moveViewToLast();
                        setup();
                        chartHandler.postDelayed(updateChartTask, UPDATE_PERIOD);
                    } else {
                        chart.setVisibleXRangeMaximum(sampleCount);
                        clean();
                        if (streamRouteManager != null) {
                            streamRouteManager.remove();
                            streamRouteManager = null;
                        }
                        chartHandler.removeCallbacks(updateChartTask);
                    }
                }
            });

    Button chartButton = (Button) view.findViewById(R.id.layout_two_button_center);
    chartButton.setText(R.string.label_pie);

    Button saveButton = (Button) view.findViewById(R.id.layout_two_button_right);
    saveButton.setText(R.string.label_save);
    saveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String filename = saveData(false);

            if (filename != null) {
                File dataFile = getActivity().getFileStreamPath(filename);
                Uri contentUri = FileProvider.getUriForFile(getActivity(),
                        "com.mbientlab.metawear.app.fileprovider2", dataFile);

                Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("text/plain");
                intent.putExtra(Intent.EXTRA_SUBJECT, filename);
                intent.putExtra(Intent.EXTRA_STREAM, contentUri);
                startActivity(Intent.createChooser(intent, "Saving Data"));
            }
        }
    });
}

From source file:com.cybrosys.palmcalc.PalmCalcActivity.java

private void feedbackmail() {
    String to = "android@cybrosys.com";
    String subject = "PalmCalc FeedBack";
    String message = etxtFeedback.getText().toString();
    if (message.length() != 0) {
        Intent email = new Intent(Intent.ACTION_SEND);
        email.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
        email.putExtra(Intent.EXTRA_SUBJECT, subject);
        email.putExtra(Intent.EXTRA_TEXT, message);
        email.setType("message/rfc822");
        startActivity(Intent.createChooser(email, "Choose an Email client :"));
        Toast.makeText(this, "Thank you for your Valuable feedback....", Toast.LENGTH_SHORT).show();
    } else {//from www .  java2  s. c o m
        Toast.makeText(this, "Please Give your feedback ", Toast.LENGTH_SHORT).show();

    }
}

From source file:es.uja.photofirma.android.LoginActivity.java

/**
 * Accin ejecutada si el usuario pulsa sobre la opcin que indica que no recuerda su contrasea,
 * abre una instancia de la aplicacin de email del dispositivo para contactar con el administrador
 * //from  w w  w . j a v  a2 s  .com
 */
public void onForgotPassword(View view) {
    Intent it = new Intent(Intent.ACTION_SEND);
    it.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.developer_email) });
    it.putExtra(Intent.EXTRA_SUBJECT, "Olvid mi contrasea...");
    it.setType("message/rfc822");
    startActivity(Intent.createChooser(it, null));
}

From source file:com.qiscus.sdk.ui.QiscusBaseChatActivity.java

protected void onSelectedCommentsAction(ActionMode mode, MenuItem item, List<QiscusComment> selectedComments) {
    int i = item.getItemId();
    String text = "";
    for (QiscusComment qiscusComment : selectedComments) {
        text += qiscusComment.getSender() + ": ";
        text += qiscusComment.isAttachment() ? qiscusComment.getAttachmentName() : qiscusComment.getMessage();
        text += "\n";
    }//from w w  w.  j a va  2 s. c  o  m

    if (i == R.id.action_copy) {
        ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText(getString(R.string.chat_activity_label_clipboard), text);
        clipboard.setPrimaryClip(clip);
        Toast.makeText(this, selectedComments.size() + " messages copied!", Toast.LENGTH_SHORT).show();
    } else if (i == R.id.action_share) {
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_SUBJECT, "Messages");
        intent.putExtra(Intent.EXTRA_TEXT, text);
        startActivity(Intent.createChooser(intent, "Share"));
    }
    mode.finish();
}

From source file:com.mech.tech.meet.activities.scenario.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_facebook) {

        String url = "http://www.facebook.com/mtmuec";
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));/*  w ww .ja v  a 2 s.  c  o m*/
        startActivity(i);
        return true;
    }

    if (id == R.id.action_twitter) {

        String url = "http://www.twitter.com/mechtechmeet";
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));
        startActivity(i);
        return true;
    }

    if (id == R.id.action_licences) {

        Intent i = new Intent(this, LicenseActivity.class);
        startActivity(i);
        return true;
    }

    if (id == R.id.action_query) {
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("message/rfc822");
        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "mechtechmeet@gmail.com" });
        intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
        intent.putExtra(Intent.EXTRA_TEXT, "message");
        Intent mailer = Intent.createChooser(intent, null);
        startActivity(mailer);

        return true;
    }

    return super.onOptionsItemSelected(item);
}