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.multivoltage.musicat.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    switch (id) {
    case R.id.action_contact:
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_SUBJECT, "Musicat - Help");
        intent.putExtra(Intent.EXTRA_TEXT, "Hi bro... ");
        Intent mailer = Intent.createChooser(intent, null);
        intent.setType("message/rfc822");
        startActivity(mailer);//from www.j a  v a  2 s  .c o  m
        break;

    case R.id.action_git:
        String url = "https://github.com/multivoltage/Musicat";
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));
        startActivity(i);
        break;

    case R.id.action_rate:
        String playstore = "https://play.google.com/store/apps/details?id=" + getPackageName();
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(playstore)));
        } catch (android.content.ActivityNotFoundException anfe) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(playstore)));
        }

    }
    return super.onOptionsItemSelected(item);
}

From source file:com.mrpoid.mrplist.ui.MrplistActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getGroupId() == R.id.mg_option) {
        if (item.getItemId() == android.R.id.home) {
            onBackPressed();/*from   www.  ja va 2s  .  c o  m*/
            return true;
        } else if (item.getItemId() == R.id.mi_refresh) {
            listFmg.refreshList();
        } else if (item.getItemId() == R.id.mi_show_dir) {
            boolean b = PreferencesProvider.Interface.General.getShowDir(false);
            PreferencesProvider.Interface.General.setShowDir(this, !b);

            listFmg.refreshList();
        } else if (item.getItemId() == R.id.mi_pref) {
            startActivity(new Intent(this, EmuPreferenceActivity.class));
        } else if (item.getItemId() == R.id.mi_help) {
            startActivity(new Intent(this, HelpActivity.class).setData(Res.HELP_URI_ASSET));
        } else if (item.getItemId() == R.id.mi_about) {
            new AboutActivity(this).show();
            startActivity(new Intent(this, HelpActivity.class).setData(Res.ABOUT_URI_ASSET));
        } else if (item.getItemId() == R.id.mi_exit) {
            finish();
        } else if (item.getItemId() == R.id.mi_shequ) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SHARE_URL));
            startActivity(intent);
        } else if (item.getItemId() == R.id.mi_share) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share));
            intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_msg) + "\n" + SHARE_URL);
            startActivity(Intent.createChooser(intent, getTitle()));
        }
    } else if (item.getGroupId() == R.id.mg_skin_color) {
        if (item.getItemId() == R.id.mi_theme_black) {
            PreferencesProvider.Interface.General.setDarkTheme(this, true);
            Toast.makeText(this, "?????", Toast.LENGTH_SHORT).show();
        } else if (item.getItemId() == R.id.mi_theme_light) {
            PreferencesProvider.Interface.General.setDarkTheme(this, false);
            Toast.makeText(this, "?????", Toast.LENGTH_SHORT).show();
        }
    } else if (item.getGroupId() == R.id.mg_skin_bg) {
        setSkin(item.getItemId());
    }

    return true;
}

From source file:com.justplay1.shoppist.features.lists.MainActivity.java

@Override
public void onFeedbackClick() {
    menuDrawer.addDrawerListener(new DrawerListener() {
        @Override/*from   ww w . j  a  v a  2  s.  c o  m*/
        public void onDrawerClosed(View drawerView) {
            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.app_email) });
            sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " Version: "
                    + ShoppistUtils.getAppVersion(MainActivity.this));
            sendIntent.setType("message/rfc822");
            startActivity(Intent.createChooser(sendIntent, getString(R.string.send_mail_using)));
            menuDrawer.removeDrawerListener(this);
        }
    });
    menuDrawer.closeDrawers();
}

From source file:com.flym.dennikn.fragment.EntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mEntriesIds != null) {
        Activity activity = getActivity();

        switch (item.getItemId()) {
        case R.id.menu_star: {
            mFavorite = !mFavorite;/*  ww  w  .  ja  va  2  s .co m*/

            if (mFavorite) {
                item.setTitle(R.string.menu_unstar).setIcon(R.drawable.rating_important);
            } else {
                item.setTitle(R.string.menu_star).setIcon(R.drawable.rating_not_important);
            }

            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentValues values = new ContentValues();
                    values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0);
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, values, null, null);

                    // Update the cursor
                    Cursor updatedCursor = cr.query(uri, null, null, null, null);
                    updatedCursor.moveToFirst();
                    mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor);
                }
            }.start();
            break;
        }
        case R.id.menu_share: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    String title = cursor.getString(mTitlePos);
                    startActivity(Intent.createChooser(
                            new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title)
                                    .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN),
                            getString(R.string.menu_share)));
                }
            }
            break;
        }
        case R.id.menu_full_screen: {
            setImmersiveFullScreen(true);
            break;
        }
        case R.id.menu_copy_clipboard: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            String link = cursor.getString(mLinkPos);
            ClipboardManager clipboard = (ClipboardManager) activity
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", link);
            clipboard.setPrimaryClip(clip);

            Toast.makeText(activity, R.string.copied_clipboard, Toast.LENGTH_SHORT).show();
            break;
        }
        case R.id.menu_mark_as_unread: {
            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, FeedData.getUnreadContentValues(), null, null);
                }
            }.start();
            activity.finish();
            break;
        }
        }
    }

    return true;
}

From source file:com.nicefontaine.seanachie.ui.imagestory.ImageStoryFragment.java

public void sendEmail() {
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND).setType("application/image")
            .putExtra(android.content.Intent.EXTRA_SUBJECT, currentStory.getCategoriesContent())
            .putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.story_create_send_with));
    String path = currentStory.getImagePath();
    if (!isNull(path)) {
        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
    }/*from w w w  . j a  v a  2s  .  c  o  m*/
    startActivity(Intent.createChooser(emailIntent, getString(R.string.story_create_sending)));
}

From source file:com.carlrice.reader.fragment.EntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mEntriesIds != null) {
        Activity activity = getActivity();

        switch (item.getItemId()) {
        case R.id.menu_star: {
            mFavorite = !mFavorite;//from w ww . j  a  va2s.  c  o  m

            if (mFavorite) {
                item.setTitle(R.string.menu_unstar).setIcon(R.drawable.rating_important);
            } else {
                item.setTitle(R.string.menu_star).setIcon(R.drawable.rating_not_important);
            }

            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentValues values = new ContentValues();
                    values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0);
                    ContentResolver cr = Application.context().getContentResolver();
                    cr.update(uri, values, null, null);

                    // Update the cursor
                    Cursor updatedCursor = cr.query(uri, null, null, null, null);
                    updatedCursor.moveToFirst();
                    mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor);
                }
            }.start();
            break;
        }
        case R.id.menu_share: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    String title = cursor.getString(mTitlePos);
                    startActivity(Intent.createChooser(
                            new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title)
                                    .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN),
                            getString(R.string.menu_share)));
                }
            }
            break;
        }
        case R.id.menu_full_screen: {
            setImmersiveFullScreen(true);
            break;
        }
        case R.id.menu_copy_clipboard: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            String link = cursor.getString(mLinkPos);
            ClipboardManager clipboard = (ClipboardManager) activity
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", link);
            clipboard.setPrimaryClip(clip);

            Toast.makeText(activity, R.string.copied_clipboard, Toast.LENGTH_SHORT).show();
            break;
        }
        case R.id.menu_mark_as_unread: {
            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentResolver cr = Application.context().getContentResolver();
                    cr.update(uri, FeedData.getUnreadContentValues(), null, null);
                }
            }.start();
            activity.finish();
            break;
        }
        }
    }

    return true;
}

From source file:com.jwork.dhammapada.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    log.v(this, "onOptionsItemSelected(" + item.getTitle() + ")");
    String appName = getString(R.string.app_name);
    String appPackage = getPackageName();
    switch (item.getItemId()) {
    case R.id.action_rate:
        Uri uri = Uri.parse("market://details?id=" + appPackage);
        Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
        try {//  ww  w  .j av  a  2  s .c  om
            startActivity(myAppLinkToMarket);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, "Failed to find Market application", Toast.LENGTH_LONG).show();
        }
        break;
    case R.id.action_donate:
        openDonate();
        break;
    case R.id.action_share:
        Intent intentText = new Intent(Intent.ACTION_SEND);
        intentText.setType("text/plain");
        intentText.putExtra(Intent.EXTRA_SUBJECT, appName);
        intentText.putExtra(Intent.EXTRA_TEXT, "Check out " + appName
                + " on Google Play! https://play.google.com/store/apps/details?id=" + appPackage);
        try {
            startActivity(Intent.createChooser(intentText, getString(R.string.share_this_app_intent)));
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, "Failed to share this application", Toast.LENGTH_LONG).show();
        }
        break;
    case R.id.action_about:
        aboutWindow.showAtLocation(this.findViewById(R.id.mainLayout), Gravity.CENTER, 0, 0);
        mainLayout.getForeground().setAlpha(200);
        break;
    case R.id.action_feedback:
        Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        String subject = "[" + Constant.APP_NAME + "] Feedback";
        sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "jwork.dhammapada.os@gmail.com" });
        sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
        sendIntent.putExtra(Intent.EXTRA_TEXT,
                "\n-------------------------------\n" + CrashHandler.getPhoneInfo(this));
        sendIntent.setType("message/rfc822");
        startActivity(Intent.createChooser(sendIntent, "Email:"));
        break;
    }
    // TODO Auto-generated method stub
    return super.onContextItemSelected(item);
}

From source file:com.itbooks.app.activities.BaseActivity.java

/**
 * Standard sharing app for sharing on actionbar.
 *///from   w w  w . j av  a  2 s.c  o m
protected static Intent getDefaultShareIntent(android.support.v7.widget.ShareActionProvider provider,
        String subject, String body) {
    if (provider != null) {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
        i.putExtra(android.content.Intent.EXTRA_TEXT, body);
        provider.setShareIntent(i);
        return i;
    }
    return null;
}

From source file:com.jozapps.MetricConverter.MainActivity.java

public void requestNewUnitEmailIntent() {
    Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:support@jozapps.com"));
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "I would like this unit to be " + "included:    "
            + "\n\n\n\n" + "Version: " + getResources().getString(R.string.VersionNumber));
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "[Converter] New unit request");

    // Search for email clients to display
    try {/*from   ww w.  j  a  va  2  s. c  om*/
        startActivityForResult(Intent.createChooser(emailIntent, "Send your email in:"), 0);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(MainActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.jaspervanriet.huntingthatproduct.Activities.CollectionActivity.java

@Override
public void onShareClick(int feedItem) {
    Product product = mProducts.get(feedItem);
    Intent share = new Intent(android.content.Intent.ACTION_SEND);
    share.setType("text/plain");
    share.putExtra(Intent.EXTRA_SUBJECT, product.getTitle());
    share.putExtra(Intent.EXTRA_TEXT, product.getProductUrl());
    startActivity(Intent.createChooser(share, "Share product"));
    FeedContextMenuManager.getInstance().hideContextMenu();
}