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.idevity.card.read.ReadMain.java

private void shareData() {
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("message/rfc822");
    String mail = g.getLogData();
    Calendar now = Calendar.getInstance();
    String[] defEmail = { this.sharedPref.getString(g.getDefaultEmail(), "") };
    String shareSubject = "IDevity ID One Reader Log (Android) - " + now.getTime().toString();
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, shareSubject);
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, mail);
    sharingIntent.putExtra(android.content.Intent.EXTRA_EMAIL, defEmail);
    startActivity(Intent.createChooser(sharingIntent, "Share Via..."));
}

From source file:com.amaze.carbonfilemanager.fragments.preference_fragments.Preffrag.java

@Override
public boolean onPreferenceClick(Preference preference) {
    final String[] sort;
    MaterialDialog.Builder builder;/*from ww w  .  java2  s.co  m*/

    switch (preference.getKey()) {
    case "columns":
        sort = getResources().getStringArray(R.array.columns);
        builder = new MaterialDialog.Builder(getActivity());
        builder.theme(utilsProvider.getAppTheme().getMaterialDialogTheme());
        builder.title(R.string.gridcolumnno);
        int current = Integer.parseInt(sharedPref.getString("columns", "-1"));
        current = current == -1 ? 0 : current;
        if (current != 0)
            current = current - 1;
        builder.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
            @Override
            public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit();
                dialog.dismiss();
                return true;
            }
        });
        builder.build().show();
        return true;
    case "theme":
        sort = getResources().getStringArray(R.array.theme);
        current = Integer.parseInt(sharedPref.getString("theme", "0"));
        builder = new MaterialDialog.Builder(getActivity());
        //builder.theme(utilsProvider.getAppTheme().getMaterialDialogTheme());
        builder.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
            @Override
            public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                utilsProvider.getThemeManager().setAppTheme(AppTheme.fromIndex(which)).save();

                Log.d("theme", AppTheme.fromIndex(which).name());

                dialog.dismiss();
                restartPC(getActivity());
                return true;
            }
        });
        builder.title(R.string.theme);
        builder.build().show();
        return true;
    case "sidebar_folders_enable":
        sharedPref.edit().putBoolean(PREFERENCE_SHOW_SIDEBAR_FOLDERS,
                !sharedPref.getBoolean(PREFERENCE_SHOW_SIDEBAR_FOLDERS, true)).apply();
        return true;
    case "sidebar_quickaccess_enable":
        sharedPref.edit().putBoolean(PREFERENCE_SHOW_SIDEBAR_QUICKACCESSES,
                !sharedPref.getBoolean(PREFERENCE_SHOW_SIDEBAR_QUICKACCESSES, true)).apply();
        return true;
    case PREFERENCE_SHOW_HIDDENFILES:
        setEnabledShortcuts();
        return false;
    case PREFERENCE_ROOTMODE:
        setEnabledShortcuts();

        /*
        boolean b = sharedPref.getBoolean("rootmode", false);
        if (b) {
            if (MainActivity.shellInteractive.isRunning()) {
                rootmode.setChecked(true);
                
            } else {  rootmode.setChecked(false);
                
                Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure), Toast.LENGTH_LONG).show();
            }
        } else {
            rootmode.setChecked(false);
                
        }
        */
        return false;
    case "feedback":
        Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("mailto", "vishalmeham2@gmail.com", null));
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager");
        startActivity(Intent.createChooser(emailIntent, getResources().getString(feedback)));
        return false;
    case PREFERENCE_KEY_ABOUT:
        startActivity(new Intent(getActivity(), AboutActivity.class));
        return false;
    case "plus_pic":
        if (gplus.isChecked()) {
            boolean b = MainActivityHelper.checkAccountsPermission(getActivity());
            if (!b)
                MainActivityHelper.requestAccountsPermission(getActivity());
        }
        return false;
    /*FROM HERE BE FRAGMENTS*/
    case "colors":
        ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.COLORS_PREFERENCE);
        return true;
    case "sidebar_folders":
        ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.FOLDERS_PREFERENCE);
        return true;
    case "sidebar_quickaccess":
        ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.QUICKACCESS_PREFERENCE);
        return true;
    case "advancedsearch":
        ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.ADVANCEDSEARCH_PREFERENCE);
        return true;
    }

    return false;
}

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

/** Handle user's long-click selection.
*
*/// w w w .  jav  a 2s. c o  m
@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
    if (menuInfo != null) {
        ArchiveSongObj selSong = (ArchiveSongObj) trackList.getAdapter().getItem(menuInfo.position);
        switch (item.getItemId()) {
        case (VibeVault.STREAM_CONTEXT_ID):
            // Start streaming.
            int track = pService.enqueue(selSong);
            pService.playSongFromPlaylist(track);
            break;
        case (VibeVault.DOWNLOAD_SONG):
            selSong.setDownloadShow(show);
            dService.addSong(selSong);
            break;
        case (VibeVault.ADD_SONG_TO_QUEUE):
            pService.enqueue(selSong);
            break;
        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 song on archive.org: " + selSong.toString());
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                    "Hey,\n\nI found a song you should listen to.  It's called " + selSong.toString()
                            + " and it's off of " + selSong.getShowTitle() + ".  You can get it here: "
                            + selSong.getLowBitRate() + "\n\nSent using VibeVault for Android.");
            startActivity(Intent.createChooser(emailIntent, "Send mail..."));
            break;
        default:
            return false;
        }
        return true;
    }
    return false;
}

From source file:com.medlog.medlogmobile.NewMessageNotification.java

public static void notify(final Context context, final String exampleString[], final int number) {
    final Resources res = context.getResources();

    // This image is used as the notification's large icon (thumbnail).
    // TODO: Remove this if your notification has no relevant thumbnail.
    final Bitmap picture = BitmapFactory.decodeResource(res, R.drawable.ml);

    final int stringLen = exampleString.length;
    if (stringLen != 4) {

    }//from   ww  w  .  jav  a2 s.  c o  m
    final String userName = exampleString[0];
    final String entries = exampleString[1];
    final String entryTitle = exampleString[2];
    final String entryBody = exampleString[3];
    final String date = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
    final String sync = "";
    final String title = res.getString(R.string.new_message_notification_title_template, entryTitle);
    final String text = res.getString(R.string.new_message_notification_placeholder_text_template, date,
            userName, entries);

    final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)

            // Set appropriate defaults for the notification light, sound,
            // and vibration.
            .setDefaults(Notification.DEFAULT_ALL)

            // Set required fields, including the small icon, the
            // notification title, and text.
            .setSmallIcon(R.drawable.notification_template_icon_bg)//.ic_stat_new_message)
            .setContentTitle(title).setContentText(text)

            // All fields below this line are optional.

            // Use a default priority (recognized on devices running Android
            // 4.1 or later)
            .setPriority(NotificationCompat.PRIORITY_DEFAULT)

            // Provide a large icon, shown with the notification in the
            // notification drawer on devices running Android 3.0 or later.
            .setLargeIcon(picture)

            // Set ticker text (preview) information for this notification.
            .setTicker(title)

            // Show a number. This is useful when stacking notifications of
            // a single type.
            .setNumber(number)

            // If this notification relates to a past or upcoming event, you
            // should set the relevant time information using the setWhen
            // method below. If this call is omitted, the notification's
            // timestamp will by set to the time at which it was shown.
            // TODO: Call setWhen if this notification relates to a past or
            // upcoming event. The sole argument to this method should be
            // the notification timestamp in milliseconds.
            //.setWhen(...)

            // Set the pending intent to be initiated when the user touches
            // the notification.
            .setContentIntent(PendingIntent.getActivity(context, 0,
                    new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.niftybull.com/MedLogRS")),
                    PendingIntent.FLAG_UPDATE_CURRENT))

            // Show expanded text content on devices running Android 4.1 or
            // later.
            .setStyle(new NotificationCompat.BigTextStyle().bigText(text).setBigContentTitle(title)
                    .setSummaryText(entryTitle))

            // Example additional actions for this notification. These will
            // only show on devices running Android 4.1 or later, so you
            // should ensure that the activity in this notification's
            // content intent provides access to the same actions in
            // another way.
            .addAction(R.drawable.ic_action_stat_share, res.getString(R.string.action_share),
                    PendingIntent.getActivity(context, 0,
                            Intent.createChooser(
                                    new Intent(Intent.ACTION_SEND).setType("text/plain")
                                            .putExtra(Intent.EXTRA_SUBJECT, title)
                                            .putExtra(Intent.EXTRA_TEXT, date + " : " + entryBody),
                                    context.getString(R.string.msg_jrv)),
                            PendingIntent.FLAG_UPDATE_CURRENT))
            .addAction(R.drawable.ic_action_stat_reply, res.getString(R.string.action_reply), null)

            // Automatically dismiss the notification when it is touched.
            .setAutoCancel(true);

    notify(context, builder.build());
}

From source file:com.dycody.android.idealnote.MainActivity.java

/**
 * Used to perform a quick text-only note saving (eg. Tasker+Pushbullet)
 *//* w  ww.  j  ava2  s. c  om*/
private void saveAndExit(Intent i) {
    Note note = new Note();
    note.setTitle(i.getStringExtra(Intent.EXTRA_SUBJECT));
    note.setContent(i.getStringExtra(Intent.EXTRA_TEXT));
    DbHelper.getInstance().updateNote(note, true);
    showToast(getString(R.string.note_updated), Toast.LENGTH_SHORT);
    finish();
}

From source file:com.nagopy.android.mypkgs.MainActivity.java

void sendIntent(String subject, String text) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType(Constants.MINE_TYPE_TEXT_PLAIN);
    intent.putExtra(Intent.EXTRA_TEXT, text);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    startActivity(intent);/*  www  .j av a2  s. c  om*/
}

From source file:com.crossconnect.activity.notemanager.NoteManagerPersonalNotesFragment.java

@Override
public void onListItemClick(ListView l, View v, int pos, long id) {

    //If it is the add new note row
    if (pos == mAdapter.getCount() - 1) {
        Intent intent = new Intent(getActivity(), PersonalNotesActivity.class);
        //            intent.putExtra(PersonalNotesEditorFragment.NOTE_BUNDLE_ID,0);
        startActivity(intent);/*w w  w  .  j  a  v  a2 s. c om*/
        return;
    }

    final int position = pos;

    //Get the corresponding resource
    final Note note = mAdapter.getItem(position);

    final ActionItem openAction = new ActionItem();

    openAction.setTitle("Open");
    openAction.setIcon(getResources().getDrawable(R.drawable.ic_action_search));

    final ActionItem deleteAction = new ActionItem();

    deleteAction.setTitle("Delete");
    deleteAction.setIcon(getResources().getDrawable(R.drawable.ic_action_delete));

    final ActionItem shareAction = new ActionItem();

    shareAction.setTitle("Share");
    shareAction.setIcon(getResources().getDrawable(R.drawable.ic_action_share));

    final QuickActionHorizontal mQuickAction = new QuickActionHorizontal(v);

    final String text = "blah";

    openAction.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, "Opening Personal Note ID:" + note.getId());
            //Open the note pass the id to it
            Intent intent = new Intent(getActivity(), PersonalNotesActivity.class);
            intent.putExtra(PersonalNotesEditorFragment.NOTE_BUNDLE_ID, note.getId());
            startActivity(intent);
            mQuickAction.dismiss();
        }
    });

    deleteAction.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            //              BibleText bibleText = new SwordBibleText( note.getBook(),  note.getChapter(), getActivity().getIntent().getExtras().getString("Translation"));
            //TODO: should use this ID instead of key but will do for now need TABLE change
            //notesService.removeNote(note.getId());
            notesService.removeNote(note.getId());
            getLoaderManager().restartLoader(0, null, NoteManagerPersonalNotesFragment.this);
            mAdapter.notifyDataSetChanged();
            mQuickAction.dismiss();
        }
    });

    mQuickAction.addActionItem(openAction);
    mQuickAction.addActionItem(deleteAction);
    shareAction.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            String text = note.getText();
            Toast.makeText(getActivity(), "Share " + text, Toast.LENGTH_SHORT).show();
            Intent sendMailIntent = new Intent(Intent.ACTION_SEND);
            sendMailIntent.putExtra(Intent.EXTRA_SUBJECT, "CrossConnect Notes");
            sendMailIntent.setType("text/plain");
            getActivity().startActivity(Intent.createChooser(sendMailIntent, "Share using..."));
            mQuickAction.dismiss();
        }
    });
    mQuickAction.addActionItem(shareAction);

    mQuickAction.setAnimStyle(QuickActionVertical.ANIM_AUTO);

    mQuickAction.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss() {
        }
    });

    mQuickAction.show();

    Log.i(TAG, "Item clicked: " + id);
}

From source file:com.hijacker.SendLogActivity.java

public void onUseEmail(View v) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("plain/text");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "kiriakopoulos44@gmail.com" });
    intent.putExtra(Intent.EXTRA_SUBJECT, "Hijacker bug report");
    Uri attachment = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", report);
    intent.putExtra(Intent.EXTRA_STREAM, attachment);
    intent.putExtra(Intent.EXTRA_TEXT, extraView.getText().toString());
    startActivity(intent);//from   w  ww .j ava2s .  co  m
}

From source file:com.cw.litenote.operation.mail.MailPagesFragment.java

void sendEMail(String strEMailAddr, // eMail address
        String[] attachmentFileName, // attachment name
        String[] picFileNameArray) // attachment picture file name
{
    mAttachmentFileName = attachmentFileName;
    // new ACTION_SEND intent
    mEMailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); // for multiple attachments

    // set type//from w  w w .  ja v  a2s.  c o m
    mEMailIntent.setType("text/plain");//can select which APP will be used to send mail

    // open issue: cause warning for Key android.intent.extra.TEXT expected ArrayList
    String text_body = mContext.getResources().getString(R.string.eMail_body)// eMail text (body)
            + " " + Util.getStorageDirName(mContext) + " (UTF-8)" + Util.NEW_LINE + mEMailBodyString;

    // attachment: message
    List<String> filePaths = new ArrayList<String>();
    for (int i = 0; i < attachmentFileName.length; i++) {
        String messagePath = "file:///" + Environment.getExternalStorageDirectory().getPath() + "/"
                + Util.getStorageDirName(mContext) + "/" + attachmentFileName[i];// message file name
        filePaths.add(messagePath);
    }

    // attachment: pictures
    if (picFileNameArray != null) {
        for (int i = 0; i < picFileNameArray.length; i++) {
            filePaths.add(picFileNameArray[i]);
        }
    }

    ArrayList<Uri> uris = new ArrayList<Uri>();
    for (String file : filePaths) {
        Uri uri = Uri.parse(file);
        uris.add(uri);
    }

    mEMailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { strEMailAddr }) // eMail address
            .putExtra(Intent.EXTRA_SUBJECT, Util.getStorageDirName(mContext) + // eMail subject
                    " " + mContext.getResources().getString(R.string.eMail_subject))// eMail subject
            .putExtra(Intent.EXTRA_TEXT, text_body) // eMail body (open issue)
            .putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); // multiple eMail attachment

    Log.v(getClass().getSimpleName(), "attachment " + Uri.parse("file name is:" + attachmentFileName));

    getActivity().startActivityForResult(
            Intent.createChooser(mEMailIntent, getResources().getText(R.string.mail_chooser_title)),
            EMAIL_PAGES);
}

From source file:com.example.nwilde.myfirstapp.settingsactivity.SettingsFragment.java

private void sendEmail() {
    Intent emailIntent = new Intent(Intent.ACTION_SEND);
    // The intent does not have a URI, so declare the "text/plain" MIME type
    emailIntent.setType(PLAIN_TEXT_TYPE);
    // recipients
    emailIntent.putExtra(Intent.EXTRA_EMAIL,
            new String[] { getResources().getString(R.string.pref_feedback_recipient) });
    String subject = getResources().getString(R.string.app_name) + " - v"
            + getResources().getString(R.string.versionName);
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    String message = getResources().getString(R.string.pref_feedback_message);
    emailIntent.putExtra(Intent.EXTRA_TEXT, message);
    startActivity(emailIntent);/*  ww w. j av a2s  .com*/
}