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.vrem.wifianalyzer.navigation.items.ExportItem.java

private Intent createIntent(String title, String data) {
    Intent intent = createSendIntent();//  w  ww  . j a v a 2  s .c o  m
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TITLE, title);
    intent.putExtra(Intent.EXTRA_SUBJECT, title);
    intent.putExtra(Intent.EXTRA_TEXT, data);
    return intent;
}

From source file:com.nus.cs4222.isbtracker.ActivityRecognitionIntentService.java

private void reportNewActivity(ActivityRecognitionResult result) {
    Intent intent = new Intent(ScannerService.UPDATE_TOPIC);
    intent.putExtra(Intent.EXTRA_SUBJECT, ActivityRecognitionHelper.ACTIVITY_RECOGNITION_EXTRA_SUBJECT);
    intent.putExtra(ActivityRecognitionHelper.ACTIVITY_RECOGNITION_RESULT, result);
    LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}

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.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:com.creationgroundmedia.popularmovies.trailers.TrailerFragment.java

@Override
public void onLoadFinished(Loader<List<TrailerItem>> loader, final List<TrailerItem> data) {
    if (data != null) {
        FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override/*from  w w  w. ja  v a  2 s .  c om*/
            public void onClick(View view) {
                if (data.size() > 0) {
                    TrailerItem trailer = data.get(0);
                    Intent intent = new Intent();
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
                    intent.setAction(Intent.ACTION_SEND);
                    intent.setType("text/*");
                    intent.putExtra(Intent.EXTRA_SUBJECT, trailer.getName());
                    intent.putExtra(Intent.EXTRA_TEXT, "https://www.youtube.com/watch?v="
                            + trailer.getYoutubeKey() + "\n\n#PopularMoviesApp");
                    ShareActionProvider shareActionProvider = new ShareActionProvider(getContext());
                    shareActionProvider.setShareIntent(intent);
                    startActivity(intent);
                } else {
                    Snackbar.make(view, "No trailers to share for this movie", Snackbar.LENGTH_LONG)
                            .setAction("Action", null).show();
                }
            }
        });
        for (TrailerItem trailer : data) {
            View tv = LayoutInflater.from(getContext()).inflate(R.layout.fragment_trailer, null);
            ((LinearLayout) mView).addView(tv);
            TextView nameView = (TextView) tv.findViewById(R.id.content);
            nameView.setText(trailer.getName());
            /**
             * the YouTube key is tucked into a hidden (GONE) TextView so that it can be used
             * to build a URL if the user clicks the enrty
             * */
            TextView keyView = (TextView) tv.findViewById(R.id.youtube_key);
            keyView.setText(trailer.getYoutubeKey());
            tv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    launchTrailerViewer(((TextView) v.findViewById(R.id.youtube_key)).getText());
                }
            });
        }
        getLoaderManager().destroyLoader(URL_TRAILERLOADER);
    }
}

From source file:com.android.shell.BugreportReceiver.java

/**
 * Build {@link Intent} that can be used to share the given bugreport.
 *//*from  w ww. ja  v a2  s  .c o m*/
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:com.paranoid.gerrit.adapters.ChangeListAdapter.java

@Override
public void bindView(View view, Context context, final Cursor cursor) {

    setIndicies(cursor);// www.ja  v a 2s.  c  om

    ViewHolder viewHolder = (ViewHolder) view.getTag();
    if (viewHolder == null) {
        viewHolder = new ViewHolder(view);
    }

    viewHolder.changeid = cursor.getString(changeid_index);
    viewHolder.changeStatus = cursor.getString(status_index);
    viewHolder.webAddress = getWebAddress(cursor.getInt(changenum_index));
    view.setTag(viewHolder);

    if (viewHolder.changeid.equals(selectedChangeId)) {
        CommitCard commitCard = (CommitCard) view;
        commitCard.setChangeSelected(true);
        selectedChangeView = commitCard;
    } else {
        ((CommitCard) view).setChangeSelected(false);
    }

    View.OnClickListener cardListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ViewHolder vh = (ViewHolder) view.getTag();
            Intent intent = new Intent(PatchSetViewerFragment.NEW_CHANGE_SELECTED);
            intent.putExtra(PatchSetViewerFragment.CHANGE_ID, vh.changeid);
            intent.putExtra(PatchSetViewerFragment.STATUS, vh.changeStatus);
            intent.putExtra(PatchSetViewerFragment.EXPAND_TAG, true);
            LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);

            // Set this view as selected
            setSelectedChangeId((CommitCard) view, vh.changeid);
        }
    };

    // Root view already has viewHolder tagged
    view.setOnClickListener(cardListener);

    viewHolder.shareView.setTag(viewHolder);
    viewHolder.shareView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ViewHolder vh = (ViewHolder) view.getTag();
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            intent.putExtra(Intent.EXTRA_SUBJECT, String.format(
                    mContext.getResources().getString(R.string.commit_shared_from_mgerrit), vh.changeid));
            intent.putExtra(Intent.EXTRA_TEXT, vh.webAddress + " #mGerrit");
            mContext.startActivity(intent);
        }
    });

    viewHolder.browserView.setTag(viewHolder);
    viewHolder.browserView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String webAddr = ((ViewHolder) view.getTag()).webAddress;
            if (webAddr != null) {
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webAddr));
                mContext.startActivity(browserIntent);
            } else {
                Toast.makeText(view.getContext(), R.string.failed_to_find_url, Toast.LENGTH_SHORT).show();
            }
        }
    });

    super.bindView(view, context, cursor);
}

From source file:com.galois.qrstream.lib.DecodeThread.java

private Intent buildIntent(Job message) throws IOException {
    Intent i = new Intent();
    i.setAction(Intent.ACTION_SEND);//w  ww .ja  v a2 s .  c  o  m
    i.addCategory(Intent.CATEGORY_DEFAULT);
    String mimeType = message.getMimeType();
    i.setType(mimeType);

    if (mimeType.equals("text/plain")) {
        String msg = new String(message.getData());
        i.putExtra(Intent.EXTRA_TEXT, msg);
    } else {
        // content that is not text uses the filesystem to store the data
        // (when sharing with a new local app)
        File dataLoc = storeData(message);

        if (mimeType.startsWith("image/")) {
            String path = Images.Media.insertImage(context.getContentResolver(), dataLoc.getPath(),
                    message.getTitle(), null);
            Uri imageUri = Uri.parse(path);
            i.putExtra(Intent.EXTRA_STREAM, imageUri);

            // we can delete the temporary location in this case, since the file has been saved
            // to the media store.
            // In the other cases, the receiver has to handle the content of the temp file before
            // it can be deleted -- but we will never know if/when that happens.
            dataLoc.delete();
        } else if (mimeType.equals(Constants.MIME_TYPE_TEXT_NOTE)) {
            String json = new String(message.getData());
            try {
                JSONObject note = new JSONObject(json);
                i.putExtra(Intent.EXTRA_TEXT, note.getString(Intent.EXTRA_TEXT));
                i.putExtra(Intent.EXTRA_SUBJECT, note.getString(Intent.EXTRA_SUBJECT));
                i.setType("text/plain");
            } catch (JSONException e) {
                e.printStackTrace();
            }
        } else {
            i.putExtra(Intent.EXTRA_STREAM, dataLoc.toURI());
        }
    }
    return i;
}

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: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));
}