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:br.com.PartoHumanizado.fragment.EnviarPlanoDePartoFragment.java

@OnClick(R.id.enviar)
public void enviar() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822");
    //        intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_EMAIL, "");
    intent.putExtra(Intent.EXTRA_SUBJECT, "Plano de Parto");
    intent.putExtra(Intent.EXTRA_TEXT, texto.getText().toString());

    startActivity(Intent.createChooser(intent, "Enviar email"));
    //        startActivity(intent);
}

From source file:com.karthikb351.vitinfo2.fragment.settings.SettingsFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    switch (position) {
    case 0:/*from ww w  .  java 2  s. co m*/
        // Reset App
        new ResetTask(getActivity()).execute();
        Intent intent = new Intent(getActivity(), LoginActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        getActivity().finish();
        break;
    case 1:
        // Show licenses of libraries
        LicensesFragment.displayLicensesFragment(getFragmentManager());
        break;
    case 2:
        // Contributor List
        ContributorsFragment contributorsFragment = new ContributorsFragment();
        this.getFragmentManager().beginTransaction().replace(R.id.flContent, contributorsFragment, null)
                .addToBackStack(null).commit();
        break;
    case 3:
        // Rate on Google Play
        Intent googlePlay = new Intent(Intent.ACTION_VIEW,
                Uri.parse(Constants.GOOGLE_PLAY_DETAILS_URL + BuildConfig.APPLICATION_ID));
        startActivity(googlePlay);
        break;
    case 4:
        // Google+ Community
        Intent googlePlus = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.GOOGLE_PLUS_COMMUNITY_URL));
        startActivity(googlePlus);
        break;
    case 5:
        // Facebook Page
        Intent facebook = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.FACEBOOK_PAGE_URL));
        startActivity(facebook);
        break;
    case 6:
        // Share app
        Intent share = new Intent(android.content.Intent.ACTION_SEND);
        share.setType(Constants.INTENT_TYPE_PLAIN);

        share.putExtra(Intent.EXTRA_SUBJECT, getActivity().getString(R.string.android_share_message_subject));
        share.putExtra(Intent.EXTRA_TEXT,
                getActivity().getString(R.string.android_share_message_start, Constants.API_BASE_URL));

        startActivity(Intent.createChooser(share, getActivity().getString(R.string.android_share_select)));
        break;
    }
}

From source file:com.elkriefy.android.apps.chubbytabby.activity.MainActivity.java

private PendingIntent createPendingEmailIntent() {
    Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "example@example.com", null));
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
    emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
    return PendingIntent.getActivity(getApplicationContext(), 0, emailIntent, 0);
}

From source file:edu.mit.mobile.android.livingpostcards.data.Card.java

/**
 * Creates an {@link Intent#ACTION_SEND} intent to share the given card.
 *
 * @param context//from  ww  w .ja  v a2s . c om
 * @param webUrl
 *            the content of the card's {@link Card#COL_WEB_URL} field. Can be a relative URL.
 * @param title
 *            the title of the card
 * @return an intent, within a chooser, that can be used with
 *         {@link Context#startActivity(Intent)}
 */
public static Intent createShareIntent(Context context, String webUrl, CharSequence title) {
    final NetworkClient nc = LocastApplication.getNetworkClient(context,
            Authenticator.getFirstAccount(context));
    final Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.setType("text/plain");
    sendIntent.putExtra(Intent.EXTRA_TEXT,
            context.getString(R.string.send_intent_message, nc.getFullUrlAsString(webUrl)));
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.send_intent_subject, title));
    return Intent.createChooser(sendIntent, context.getString(R.string.send_intent_chooser_title));

}

From source file:com.google.android.apps.mytracks.fragments.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 Tracks 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:ayushi.view.fragment.ContactUsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_about, container, false);

    getActivity().setTitle("Contact Us");

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }//from   ww w. j  a  va 2  s  . co m

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    mToolbar.setTitleTextColor(Color.WHITE);

    rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });

    rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent callIntent = new Intent(Intent.ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:" + "8888813275"));
            startActivity(callIntent);

        }
    });

    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
    rootView.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {

                Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT,
                        ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP);

            }
            return true;
        }
    });

    rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://hiteshsahu.com/"));
            startActivity(browserIntent);

        }
    });

    rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                    new String[] { "hiteshkumarsahu1990@gmail.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");

            emailIntent.setType("message/rfc822");

            try {
                startActivity(Intent.createChooser(emailIntent, "Send email using..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
            }

        }
    });

    return rootView;
}

From source file:com.sakisds.icymonitor.activities.AboutActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        finish();//from www  .ja  v a2  s.  com
        return (true);
    case R.id.item_github:
        Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                Uri.parse("http://sakisds.github.io/Icy-Monitor/"));
        startActivity(browserIntent);
        return true;
    case R.id.item_contact:
        Uri uri = Uri.parse("mailto:sakisds.s@gmail.com");
        Intent emailIntent = new Intent(Intent.ACTION_SENDTO, uri);
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Icy Monitor Feedback");
        startActivity(emailIntent);
        return true;
    }
    return (super.onOptionsItemSelected(item));
}

From source file:de.appplant.cordova.plugin.emailcomposer.EmailComposer.java

/**
 * Setzt den Subject der Mail.
 */
private void setSubject(String subject, Intent draft) {
    draft.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
}

From source file:com.enadein.carlogbook.ui.AboutFragment.java

public void sendEmail(String subject) {
    Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getString(R.string.email), null));
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);

    startActivity(Intent.createChooser(intent, "Send Email"));
}

From source file:com.hitesh_sahu.retailapp.view.fragment.ContactUsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.frag_about, container, false);

    getActivity().setTitle("Contact Us");

    mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar);
    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar);
    }/*ww  w.  ja va2 s . c  om*/

    if (mToolbar != null) {
        ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mToolbar.setNavigationIcon(R.drawable.ic_drawer);

    }

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START);
        }
    });

    mToolbar.setTitleTextColor(Color.WHITE);

    rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

        }
    });

    rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent callIntent = new Intent(Intent.ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:" + "8888813275"));
            startActivity(callIntent);

        }
    });

    rootView.setFocusableInTouchMode(true);
    rootView.requestFocus();
    rootView.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {

                Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT,
                        ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP);

            }
            return true;
        }
    });

    rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://hiteshsahu.com/"));
            startActivity(browserIntent);

        }
    });

    rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "hiteshkrsahu@gmail.com" });
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");

            emailIntent.setType("message/rfc822");

            try {
                startActivity(Intent.createChooser(emailIntent, "Send email using..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
            }

        }
    });

    return rootView;
}