Example usage for android.content Intent ACTION_SENDTO

List of usage examples for android.content Intent ACTION_SENDTO

Introduction

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

Prototype

String ACTION_SENDTO

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

Click Source Link

Document

Activity Action: Send a message to someone specified by the data.

Usage

From source file:tech.salroid.filmy.activities.AboutActivity.java

public void sendEmail(View view) {

    switch (view.getId()) {

    case R.id.email:

        Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
        emailIntent.setData(Uri.parse("mailto: webianksc@gmailcom"));
        startActivity(Intent.createChooser(emailIntent, "Send feedback"));

        break;// w w w  .ja va  2  s.  c  om

    case R.id.email2:

        Intent emailIntent2 = new Intent(Intent.ACTION_SENDTO);
        emailIntent2.setData(Uri.parse("mailto: gupta.sajal631@gmail.com"));
        startActivity(Intent.createChooser(emailIntent2, "Send feedback"));

        break;

    }

}

From source file:cw.kop.autobackground.tutorial.FinishFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.tutorial_finish_fragment, container, false);
    int colorFilterInt = AppSettings.getColorFilterInt(appContext);

    TextView titleText = (TextView) view.findViewById(R.id.title_text);
    titleText.setTextColor(colorFilterInt);
    titleText.setText("That's it.");

    TextView tutorialText = (TextView) view.findViewById(R.id.tutorial_text);
    tutorialText.setTextColor(colorFilterInt);
    tutorialText.setText("Now you're ready to use AutoBackground. I'd suggest adding a new source first "
            + "and then hitting download." + "\n" + "\n"
            + "If you have any questions, concerns, suggestions, or whatever else, feel free to "
            + "email me at ");
    SpannableString emailString = new SpannableString("chiuwinson@gmail.com");
    ClickableSpan clickableSpan = new ClickableSpan() {
        @Override/*from  ww  w . ja  v  a 2 s .c  o  m*/
        public void onClick(View widget) {
            Log.i(TAG, "Clicked");
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", "chiuwinson@gmail.com", null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "AutoBackground Feedback");
            startActivity(Intent.createChooser(emailIntent, "Send email"));
        }
    };
    emailString.setSpan(clickableSpan, 0, emailString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    tutorialText.append(emailString);
    tutorialText.append(".");
    tutorialText.setMovementMethod(LinkMovementMethod.getInstance());

    return view;
}

From source file:bg.tudle.mtbtimer.ui.MTBMainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SENDTO);
    intent.setType("text/plain");
    switch (item.getItemId()) {
    case R.id.menu_feedback:
        intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.send_from_my_android));
        intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
        intent.setData(Uri.parse(getString(R.string.mailto_dimitarniknikolov_gmail_com)));
        break;/*  www  . ja v a 2 s.  co  m*/
    case R.id.menu_share:
        intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.download_apk_link_) + DOWNLOAD_APP_LINK
                + getString(R.string.send_from_my_android));
        intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.checkout_mtbtimer_for_android));
        intent.setData(Uri.parse("mailto:"));
        break;
    case R.id.menu_about:
        try {
            PackageManager manager = getPackageManager();
            PackageInfo info = manager.getPackageInfo(getPackageName(), 0);
            String aboutMsg = getString(R.string.versioncode_) + info.versionCode
                    + getString(R.string._versionname_) + info.versionName;
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(R.string.app_name).setMessage(aboutMsg).setNeutralButton(R.string.ok, null).show();
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
        return true;
    default:
        break;
    }
    startActivity(intent);
    return super.onOptionsItemSelected(item);
}

From source file:com.marcosedo.lagramola.HelpFragment.java

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

    //////////LISTVIEW, ADAPTER Y TEXTO DE LOS MENUS
    final Resources resources = getResources();
    listView = (ListView) view.findViewById(android.R.id.list);
    List<Map<String, String>> data = new ArrayList<Map<String, String>>();
    String[] titles_str = { resources.getString(R.string.appVersionTxt),
            resources.getString(R.string.feedbackMail), resources.getString(R.string.OSLicenses) };
    String[] subtitles_str = { resources.getString(R.string.appVersionNumber),
            resources.getString(R.string.myEmailAddress), "" };

    for (int i = 0; i < titles_str.length; i++) {
        Map<String, String> datum = new HashMap<String, String>(2);
        datum.put("title", titles_str[i]);
        datum.put("subtitle", subtitles_str[i]);
        data.add(datum);//from www.ja  v  a 2  s . com
    }

    SimpleAdapter adapter = new SimpleAdapter(getActivity(), data, android.R.layout.simple_list_item_2,
            new String[] { "title", "subtitle" }, new int[] { android.R.id.text1, android.R.id.text2 });
    listView.setAdapter(adapter);

    //LISTENER DEL LIST VIEW esto nos saca el context menu con un solo click
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterview, View v, int position, long arg3) {

            Resources resource = getActivity().getResources();

            switch (position) {
            case 1:
                Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                        Uri.fromParts("mailto", Constantes.MY_EMAIL, null));
                emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
                emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
                startActivity(Intent.createChooser(emailIntent, "Enviar email..."));
                break;
            case 2:
                String LicenseInfo = resource.getString(R.string.headerOSLicenses)
                        + GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity());
                AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(getActivity());
                LicenseDialog.setTitle(resource.getString(R.string.OSLicenses));

                if (LicenseInfo != null) {
                    LicenseDialog.setMessage(LicenseInfo);
                    LicenseDialog.show();
                    break;
                }
            }
        }
    });

    return view;
}

From source file:com.github.fi3te.iliasdownloader.view.util.MenuItemSelectedUtil.java

public static boolean onOptionsItemSelected(final FragmentActivity activity, MenuItem item) {
    int id = item.getItemId();
    switch (id) {
    case R.id.coursesItem:
        FragmentManager fm = activity.getSupportFragmentManager();
        Fragment loadCoursesTask = new LoadCoursesDialogFragment();
        fm.beginTransaction().add(loadCoursesTask, IliasActivity.TASK_FRAGMENT_TAG).commit();
        fm.executePendingTransactions();
        return true;
    case R.id.licencesItem:
        activity.startActivity(new Intent(activity, LicensesActivity.class));
        return true;
    case R.id.imprintItem:
        DialogUtil.showImprint(activity);
        return true;
    case R.id.aboutItem:
        String version = null;/*ww  w  . jav  a2s .c o  m*/
        try {
            PackageInfo packageInfo = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0);
            version = packageInfo.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        final String v = (version == null) ? "" : (" " + version);
        new MaterialDialog.Builder(activity).icon(activity.getResources().getDrawable(R.mipmap.ic_launcher))
                .title(activity.getResources().getString(R.string.about))
                .content(activity.getResources().getString(R.string.app_name)
                        + ((version != null) ? (" " + version) : "") + "\n" + "Fiete Wennier" + "\n"
                        + "https://github.com/fi3te/ILIASDownloaderAndroid")
                .positiveText(activity.getResources().getString(R.string.support))
                .callback(new MaterialDialog.ButtonCallback() {
                    @Override
                    public void onPositive(MaterialDialog dialog) {
                        Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                                Uri.fromParts("mailto", "fiete.wennier@gmail.com", null));
                        emailIntent.putExtra(Intent.EXTRA_SUBJECT,
                                activity.getResources().getString(R.string.app_name) + v);
                        activity.startActivity(Intent.createChooser(emailIntent, "E-Mail"));

                        dialog.cancel();
                    }
                }).show();
        return true;
    }
    return false;
}

From source file:fr.masciulli.drinks.ui.activity.MainActivity.java

private void sendFeedback() {
    Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
    String uriText = "mailto:" + Uri.encode(getString(R.string.feedback_mail)) + "?subject="
            + Uri.encode(getString(R.string.feedback_default_subject));
    Uri uri = Uri.parse(uriText);//  w  w w. ja v  a2  s .c  om
    sendIntent.setData(uri);
    startActivity(Intent.createChooser(sendIntent, getString(R.string.action_feedback)));
}

From source file:com.android.mms.widget.MmsWidgetProvider.java

/**
 * Update the widget appWidgetId/*from w w  w  .j  a va2 s .  c om*/
 */
private static void updateWidget(Context context, int appWidgetId) {
    if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) {
        Log.v(TAG, "updateWidget appWidgetId: " + appWidgetId);
    }
    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
    PendingIntent clickIntent;

    // Launch an intent to avoid ANRs
    final Intent intent = new Intent(context, MmsWidgetService.class);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
    remoteViews.setRemoteAdapter(appWidgetId, R.id.conversation_list, intent);

    remoteViews.setTextViewText(R.id.widget_label, context.getString(R.string.sms_app_label));

    // Open Mms's app conversation list when click on header
    final Intent convIntent = new Intent(context, ConversationList.class);
    clickIntent = PendingIntent.getActivity(context, 0, convIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);

    // On click intent for Compose
    final Intent composeIntent = new Intent(context, ComposeMessageActivity.class);
    composeIntent.setAction(Intent.ACTION_SENDTO);
    clickIntent = PendingIntent.getActivity(context, 0, composeIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent);

    // On click intent for Conversation
    TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
    taskStackBuilder.addParentStack(ComposeMessageActivity.class);
    Intent msgIntent = new Intent(Intent.ACTION_VIEW);
    msgIntent.setType("vnd.android-dir/mms-sms");
    taskStackBuilder.addNextIntent(msgIntent);
    remoteViews.setPendingIntentTemplate(R.id.conversation_list,
            taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT));

    AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteViews);
}

From source file:com.slensky.focussis.fragments.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_about, container, false);

    //        ImageView logo = (ImageView) view.findViewById(R.id.image_logo);
    //        ConstraintLayout.LayoutParams lp = (ConstraintLayout.LayoutParams) logo.getLayoutParams();
    //        lp.setMargins(lp.leftMargin, ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight() / 10, lp.rightMargin, lp.bottomMargin);
    //        logo.setLayoutParams(lp);

    TextView version = (TextView) view.findViewById(R.id.text_version);
    version.setText("Version " + this.version);
    //TextView copyright = (TextView) view.findViewById(R.id.text_copyright);
    //copyright.setText(String.format(getString(R.string.copyright), Calendar.getInstance().get(Calendar.YEAR)));
    //TextView license = (TextView) view.findViewById(R.id.text_license);

    ImageView mailIcon = (ImageView) view.findViewById(R.id.email_icon);
    mailIcon.setColorFilter(Color.argb(132, 0, 0, 0), PorterDuff.Mode.MULTIPLY);
    ImageView githubIcon = (ImageView) view.findViewById(R.id.github_icon);
    githubIcon.setColorFilter(Color.argb(132, 0, 0, 0), PorterDuff.Mode.MULTIPLY);
    ImageView licenseIcon = (ImageView) view.findViewById(R.id.version_icon);
    licenseIcon.setColorFilter(Color.argb(132, 0, 0, 0), PorterDuff.Mode.MULTIPLY);

    /*license.setOnClickListener(new View.OnClickListener() {
    @Override//w ww  . ja va  2 s. c o m
    public void onClick(View v) {
        Uri uri = Uri.parseRequirements(getString(R.string.about_license_link));
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }
    });*/

    RelativeLayout emailLayout = (RelativeLayout) view.findViewById(R.id.email_layout);
    emailLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", getString(R.string.about_email), null));
            startActivity(Intent.createChooser(intent, "Send Email"));
        }
    });

    RelativeLayout githubLayout = (RelativeLayout) view.findViewById(R.id.github_layout);
    githubLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Uri uri = Uri.parse(getString(R.string.about_github_link));
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
        }
    });

    return view;
}

From source file:com.concentriclivers.mms.com.android.mms.widget.MmsWidgetProvider.java

/**
 * Update the widget appWidgetId//  www.j ava  2s . co m
 */
private static void updateWidget(Context context, int appWidgetId) {
    //        if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) {
    Log.v(TAG, "updateWidget appWidgetId: " + appWidgetId);
    //        }
    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
    PendingIntent clickIntent;

    // Launch an intent to avoid ANRs
    final Intent intent = new Intent(context, MmsWidgetService.class);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
    remoteViews.setRemoteAdapter(appWidgetId, R.id.conversation_list, intent);

    remoteViews.setTextViewText(R.id.widget_label, context.getString(R.string.app_label));

    // Open Mms's app conversation list when click on header
    final Intent convIntent = new Intent(context, ConversationList.class);
    clickIntent = PendingIntent.getActivity(context, 0, convIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);

    // On click intent for Compose
    final Intent composeIntent = new Intent(context, ComposeMessageActivity.class);
    composeIntent.setAction(Intent.ACTION_SENDTO);
    clickIntent = PendingIntent.getActivity(context, 0, composeIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent);

    // On click intent for Conversation
    TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
    taskStackBuilder.addParentStack(ComposeMessageActivity.class);
    Intent msgIntent = new Intent(Intent.ACTION_VIEW);
    msgIntent.setType("vnd.android-dir/mms-sms");
    taskStackBuilder.addNextIntent(msgIntent);
    remoteViews.setPendingIntentTemplate(R.id.conversation_list,
            taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT));

    AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteViews);
}

From source file:com.photbit.weatherse.app.ui.settings.AboutFragment.java

@Override
public void contactClicked(String contactString) {
    Intent send = new Intent(Intent.ACTION_SENDTO);
    String uriText = "mailto:" + Uri.encode(contactString);
    Uri uri = Uri.parse(uriText);//from   w w w .  java2s  .  c o m

    send.setData(uri);
    startActivity(Intent.createChooser(send, ""));
}