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:library.artaris.cn.library.utils.SystemUtils.java

/**
 * ??/*from  www .jav a2  s  .  com*/
 * @param context
 * @param smsBody
 */
public static void sendSMS(Context context, String smsBody) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    intent.putExtra("sms_body", smsBody);
    context.startActivity(intent);
}

From source file:com.android.example.notificationshowcase.NotificationService.java

private static PendingIntent makeEmailIntent(Context context, String who) {
    final Intent intent = new Intent(android.content.Intent.ACTION_SENDTO, Uri.parse("mailto:" + who));
    return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
}

From source file:com.artemchep.horario.ui.dialogs.FeedbackDialog.java

/**
 * @return {@code true} if this device can send feedback email,
 * {@code false} otherwise./*from w  w w  .  j  a  v a 2  s .c  om*/
 */
public static boolean isSupported(@NonNull Context context) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:")); // only email apps should handle it
    PackageManager pm = context.getPackageManager();
    return pm != null && intent.resolveActivity(pm) != null;
}

From source file:co.dilaver.quoter.fragments.AboutMeFragment.java

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

    TextView mail = (TextView) view.findViewById(R.id.tvEmail);
    TextView twitter = (TextView) view.findViewById(R.id.tvTwitter);
    TextView facebook = (TextView) view.findViewById(R.id.tvFacebook);
    TextView linkedIn = (TextView) view.findViewById(R.id.tvLinkedIn);

    mail.setOnClickListener(new View.OnClickListener() {
        @Override/* w w w  .  ja  v a 2 s.co  m*/
        public void onClick(View v) {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
            emailIntent.setData(Uri.parse("mailto: mdilaveroglu@gmail.com"));
            startActivity(emailIntent);
        }
    });
    twitter.setMovementMethod(LinkMovementMethod.getInstance());
    facebook.setMovementMethod(LinkMovementMethod.getInstance());
    linkedIn.setMovementMethod(LinkMovementMethod.getInstance());

    return view;
}

From source file:com.github.akinaru.bleanalyzer.menu.MenuUtils.java

/**
 * Execute actions according to selected menu item
 *
 * @param menuItem MenuItem object//from www .  j  a va 2s  . c o  m
 * @param mDrawer  navigation drawer
 * @param context  android context
 */
public static void selectDrawerItem(MenuItem menuItem, DrawerLayout mDrawer, Context context,
        IBtActivity activity) {

    switch (menuItem.getItemId()) {
    case R.id.switch_chart_data: {
        break;
    }
    case R.id.rfdroid: {
        Intent i = new Intent(context, RFdroidActivity.class);
        context.startActivity(i);
        break;
    }
    case R.id.scan_btn_nv: {
        if (activity != null)
            activity.toggleScan();
        break;
    }
    case R.id.report_bugs: {
        Intent intent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("mailto", context.getResources().getString(R.string.email_addr), null));
        intent.putExtra(Intent.EXTRA_SUBJECT, context.getResources().getString(R.string.issue_subject));
        intent.putExtra(Intent.EXTRA_TEXT, context.getResources().getString(R.string.report_hint));
        context.startActivity(
                Intent.createChooser(intent, context.getResources().getString(R.string.issue_title)));
        break;
    }
    case R.id.open_source_components: {
        OpenSourceItemsDialog d = new OpenSourceItemsDialog(context);
        d.show();
        break;
    }
    case R.id.about_app: {
        AboutDialog dialog = new AboutDialog(context);
        dialog.show();
        break;
    }
    }
    mDrawer.closeDrawers();
}

From source file:com.github.akinaru.bleremote.menu.MenuUtils.java

/**
 * Execute actions according to selected menu item
 *
 * @param menuItem MenuItem object/* w w w. j a v  a2 s . com*/
 * @param mDrawer  navigation drawer
 * @param context  android context
 */
public static void selectDrawerItem(MenuItem menuItem, DrawerLayout mDrawer, Context context,
        IRemoteActivity remoteActivity) {

    switch (menuItem.getItemId()) {
    case R.id.disconnect_device: {
        if (remoteActivity != null) {
            remoteActivity.disconnect();
        }
        break;
    }
    case R.id.report_bugs: {
        Intent intent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("mailto", context.getResources().getString(R.string.email_addr), null));
        intent.putExtra(Intent.EXTRA_SUBJECT, context.getResources().getString(R.string.issue_subject));
        intent.putExtra(Intent.EXTRA_TEXT, context.getResources().getString(R.string.report_hint));
        context.startActivity(
                Intent.createChooser(intent, context.getResources().getString(R.string.issue_title)));
        break;
    }
    case R.id.open_source_components: {
        OpenSourceItemsDialog d = new OpenSourceItemsDialog(context);
        d.show();
        break;
    }
    case R.id.about_app: {
        AboutDialog dialog = new AboutDialog(context);
        dialog.show();
        break;
    }
    }
    mDrawer.closeDrawers();
}

From source file:com.thelastcrusade.soundstream.components.AboutFragment.java

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

    final TextView repoLinkText = (TextView) v.findViewById(R.id.repo_link),
            SlidingMenuLinkText = (TextView) v.findViewById(R.id.thanks_SlidingMenu),
            emailLinkText = (TextView) v.findViewById(R.id.email_link);

    listenToHttpLink(repoLinkText, getString(R.string.repo_link));
    listenToHttpLink(SlidingMenuLinkText, getString(R.string.sliding_menu_link));

    emailLinkText.setOnClickListener(new AdapterView.OnClickListener() {

        @Override//  w w  w .  ja v a 2 s .  c  o m
        public void onClick(View v) {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", getString(R.string.email_support_address), null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_subject_tag));
            startActivity(Intent.createChooser(emailIntent, "Send email..."));
        }
    });

    v.findViewById(R.id.instructions_text).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            new InstructionsDialog(getActivity()).show();

        }
    });

    return v;
}

From source file:com.github.akinaru.hcidebugger.menu.MenuUtils.java

/**
 * Execute actions according to selected menu item
 *
 * @param menuItem MenuItem object//  w  w w  . j av a2 s  .  c  om
 * @param mDrawer  navigation drawer
 */
public static void selectDrawerItem(MenuItem menuItem, DrawerLayout mDrawer, Context context,
        final IHciDebugger activity, IDialog dialogCb) {

    switch (menuItem.getItemId()) {
    case R.id.set_max_packet_num: {
        if (activity != null) {
            MaxPacketCountDialog dialog = new MaxPacketCountDialog(activity);
            dialogCb.setCurrentDialog(dialog);
            dialog.show();
        }
        break;
    }
    case R.id.browse_file: {
        if (activity != null) {
            SnoopFileDialog dialog = new SnoopFileDialog(activity);
            dialogCb.setCurrentDialog(dialog);
            dialog.show();
        }
        break;
    }
    case R.id.report_bugs: {
        Intent intent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("mailto", context.getResources().getString(R.string.developper_mail), null));
        intent.putExtra(Intent.EXTRA_SUBJECT, context.getResources().getString(R.string.issue_object));
        intent.putExtra(Intent.EXTRA_TEXT, context.getResources().getString(R.string.issue_message));
        context.startActivity(
                Intent.createChooser(intent, context.getResources().getString(R.string.issue_title)));
        break;
    }
    case R.id.scan_btn_nv: {
        activity.toggleScan(menuItem);
        break;
    }
    case R.id.reset_snoop_file_nv: {
        activity.resetSnoopFile();
        activity.refresh();
        break;
    }
    case R.id.state_bt_btn_nv: {
        activity.toggleBtState();
        break;
    }
    case R.id.change_settings: {

        CharSequence[] array = { "Classic/BLE scan", "BLE scan" };

        int indexCheck = 0;
        if (activity.getScanType() == ScanType.BLE_SCAN) {
            indexCheck = 1;
        }

        Dialog dialog = new AlertDialog.Builder(context).setSingleChoiceItems(array, indexCheck, null)
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        dialog.dismiss();
                        int selectedPosition = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
                        if (selectedPosition == 0) {
                            activity.setScanType(ScanType.CLASSIC_SCAN);
                        } else {
                            activity.setScanType(ScanType.BLE_SCAN);
                        }
                    }
                }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        dialog.dismiss();
                    }
                }).show();
        dialogCb.setCurrentDialog(dialog);
        break;
    }
    case R.id.open_source_components: {
        OpenSourceItemsDialog dialog = new OpenSourceItemsDialog(context);
        dialogCb.setCurrentDialog(dialog);
        dialog.show();
        break;
    }
    case R.id.rate_app: {
        context.startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse("market://details?id=" + context.getApplicationContext().getPackageName())));
        break;
    }
    case R.id.about_app: {
        AboutDialog dialog = new AboutDialog(context);
        dialogCb.setCurrentDialog(dialog);
        dialog.show();
        break;
    }
    }
    mDrawer.closeDrawers();
}

From source file:com.twolinessoftware.android.mobileresume.fragment.ContactViewFragment.java

@OnClick(R.id.card_contact_email)
public void onSendEmail(View view) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:"));
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "john@2linessoftware.com" });
    intent.putExtra(Intent.EXTRA_SUBJECT, "Feedback");

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

From source file:com.android.common.util.IntentUtils.java

/**
 * Send message/*  ww w.j  ava  2  s . c o  m*/
 *
 * @param context
 * @param sendNo
 * @param sendContent
 */
public static void sendMessage(Context context, String sendNo, String sendContent) {
    Uri uri = Uri.parse("smsto:" + sendNo);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", sendContent);
    context.startActivity(intent);
}