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:it.smartcampuslab.riciclo.FeedbackFragment.java

@Override
public void onStart() {
    super.onStart();
    ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(getString(R.string.feedback_title));

    Button send = (Button) getView().findViewById(R.id.feedback_btn);
    send.setOnClickListener(new OnClickListener() {
        @Override/*from ww  w. ja v a  2  s  .  c om*/
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", getString(R.string.feedback_to), null));
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.feedback_subject));
            String text = ((EditText) getView().findViewById(R.id.feedback_text_et)).getText().toString();
            if (RifiutiHelper.locationHelper.getLocation() != null) {
                mLocation = RifiutiHelper.locationHelper.getLocation();
                text += " \n\n[" + mLocation.getLatitude() + "," + mLocation.getLongitude() + "]";
                Log.e(getClass().getSimpleName(), "Feedback text: " + text);
            }
            intent.putExtra(Intent.EXTRA_TEXT, text);
            if (imageUri != null) {
                // intent.setType("application/image");
                intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imageUri));
            }
            getActivity().startActivity(Intent.createChooser(intent, getString(R.string.feedback_mail)));
        }
    });

    OnClickListener clickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            startCamera();
        }
    };
    getView().findViewById(R.id.feedback_img).setOnClickListener(clickListener);
    getView().findViewById(R.id.feedback_img_text).setOnClickListener(clickListener);

    CheckBox check = (CheckBox) getView().findViewById(R.id.feedback_gps);
    if (check.isChecked()) {
        useLocation = true;
    }
    check.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            useLocation = isChecked;
            if (isChecked) {
                // getActivity().setProgressBarIndeterminateVisibility(true);
                RifiutiHelper.locationHelper.start();
            } else {
                RifiutiHelper.locationHelper.stop();
                // getActivity().setProgressBarIndeterminateVisibility(false);
            }
        }
    });
}

From source file:com.zion.htf.ui.InfoDetailsActivity.java

@Override
public void onCreate(Bundle savedInstance) {
    super.onCreate(savedInstance);

    this.context = this;

    String resourceName = this.getIntent().getStringExtra(InfoDetailsActivity.name);
    if (null == resourceName) {
        throw new RuntimeException("This requires a 'name' parameter in its starting intent.");
    }/*from www .  jav  a 2 s.c  o  m*/

    this.setTitle(this.getString(this.getResources().getIdentifier(resourceName, "string", "com.zion.htf")));

    this.webView = new WebView(this);
    this.webView.loadDataWithBaseURL("file:///android_res/raw/", this.readTextFromResource(resourceName),
            "text/html", "utf-8", null);
    this.webView.setBackgroundColor(0x00000000);
    if ("info_about".equals(resourceName) || "info_open_source".equals(resourceName))
        this.webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Log.v(InfoDetailsActivity.TAG, url);
                boolean ret = false;
                if (url.contains("github.com/nstCactus")) {
                    InfoDetailsActivity.this.startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("https://github.com/nstCactus/Hadra-Trance-Festival")));
                    ret = true;
                } else if (url.contains("donate.me")) {
                    InfoDetailsActivity.this
                            .startActivity(new Intent(InfoDetailsActivity.this, DonateActivity.class));
                    ret = true;
                } else if (url.contains("mailto:")) {
                    Log.v(url, url);
                    InfoDetailsActivity.this.startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse(url)));
                    ret = true;
                }

                return ret;
            }

            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                Log.v(InfoDetailsActivity.TAG, "onPageStarted called");
                if (shouldOverrideUrlLoading(view, url)) {
                    view.stopLoading();
                }
            }
        });

    this.setContentView(this.webView);

}

From source file:com.mmga.litedo.activity.SettingsActivity.java

private void sendEmail() {
    Uri uri = Uri.parse("mailto:1034752946@qq.com");
    String[] email = { "1034752946@qq.com" };
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra(Intent.EXTRA_CC, email); // ?
    intent.putExtra(Intent.EXTRA_SUBJECT, ""); // 
    intent.putExtra(Intent.EXTRA_TEXT, ""); // 
    startActivity(Intent.createChooser(intent, ""));
}

From source file:com.lhr.jiandou.fragment.SettingFragment.java

@Override
public boolean onPreferenceClick(Preference preference) {
    switch (preference.getKey()) {
    case PREF_KEY_FEEDBACK:
        Intent emailintent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("mailto", "13435500980@163.com", null));
        startActivity(Intent.createChooser(emailintent, ""));
        break;/*from   w ww  .  j a  va 2  s  . com*/
    case PREF_KEY_PROTOCOL:
        showApacheLicenseDialog();
        break;
    case PREF_KEY_CACHE:
        ClearCacheUtils.deleteDir(getActivity().getCacheDir());
        Cache.setSummary(ClearCacheUtils.getCacheSize());
        ToastUtils.show(getActivity(), "?");
        break;
    }
    return true;
}

From source file:com.example.venkatagovardhan.docorganizer.AboutActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.btnFeedback:
        try {/*  ww  w .jav  a2s. c  om*/
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
            emailIntent.setData(Uri.parse("mailto:" + FEEDBACK_ADDRESS));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " feedback");
            startActivity(emailIntent);
        } catch (Exception e) {
            e.printStackTrace();
        }
        break;

    case R.id.btnPlaystore:
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAYSTORE_URL));
            startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
        break;

    }
}

From source file:jp.kyuuki.rensou.android.activity.BaseActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    FragmentManager manager = getSupportFragmentManager();
    DialogFragment dialog;/*from   w ww. j a v  a  2  s.  co  m*/

    Intent intent;

    switch (item.getItemId()) {
    case R.id.action_ranking:
        // ?
        EasyTracker.getTracker().sendEvent(Analysis.GA_EC_UI_ACTION, Analysis.GA_EA_MENU_RANKING, null, null);
        intent = new Intent(this, RankingActivity.class);
        startActivity(intent);
        return true;
    case R.id.action_about:
        EasyTracker.getTracker().sendEvent(Analysis.GA_EC_UI_ACTION, Analysis.GA_EA_MENU_ABOUT, null, null);
        // ????
        //            AlertDialog.Builder ab = new AlertDialog.Builder(this);
        //            AlertDialog ad = ab.create();
        //            ad.setTitle(getString(R.string.action_about));
        //            ad.setMessage(getString(R.string.app_name) + " " + versionName);
        //            ad.show();
        dialog = new AboutDialogFragment();
        dialog.show(manager, "dialog");
        return true;
    case R.id.action_license:
        dialog = new LicenseInfomationDialogFragment();
        dialog.show(manager, "dialog");
        return true;
    case R.id.action_request:
        intent = new Intent();
        intent.setAction(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("mailto:" + getString(R.string.request_email)));
        //intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"kyuuki.japan+rensou@gmail.com"});
        intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.request_subject));
        intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.request_text, Utils.getVersionName(this),
                Build.VERSION.RELEASE, Build.MANUFACTURER + " " + Build.MODEL));
        startActivity(intent);
        return true;
    case R.id.action_debug:
        Intent i = new Intent(this, AboutActivity.class);
        startActivity(i);
        return true;
    }

    return false;
}

From source file:com.xxoo.slidingmenu.demo.fragments.ResponsiveUIActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        toggle();//from w w w .  j ava2 s  .  c o  m
        break;
    case R.id.github:
        Util.goToGitHub(this);
        return true;
    case R.id.about:
        new AlertDialog.Builder(this).setTitle(R.string.about)
                .setMessage(Html.fromHtml(getString(R.string.about_msg))).show();
        break;
    case R.id.licenses:
        new AlertDialog.Builder(this).setTitle(R.string.licenses)
                .setMessage(Html.fromHtml(getString(R.string.apache_license))).show();
        break;
    case R.id.contact:
        final Intent email = new Intent(android.content.Intent.ACTION_SENDTO);
        String uriText = "mailto:jfeinstein10@gmail.com" + "?subject="
                + URLEncoder.encode("SlidingMenu Demos Feedback");
        email.setData(Uri.parse(uriText));
        try {
            startActivity(email);
        } catch (Exception e) {
            Toast.makeText(this, R.string.no_email, Toast.LENGTH_SHORT).show();
        }
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:spit.matrix2017.Fragments.CommitteeFragment.java

@Nullable
@Override//from   w  ww .j av  a  2 s .c o m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_committee, container, false);

    secretary = (LinearLayout) view.findViewById(R.id.secretary_email);
    cp = (LinearLayout) view.findViewById(R.id.cp_email);
    vcp = (LinearLayout) view.findViewById(R.id.vcp_email);
    exec = (LinearLayout) view.findViewById(R.id.exec_email);
    tech = (LinearLayout) view.findViewById(R.id.tech_email);
    pr = (LinearLayout) view.findViewById(R.id.pr_email);
    marketing = (LinearLayout) view.findViewById(R.id.marketing_email);
    events = (LinearLayout) view.findViewById(R.id.events_email);
    decor = (LinearLayout) view.findViewById(R.id.decor_email);
    admin = (LinearLayout) view.findViewById(R.id.admin_email);
    security = (LinearLayout) view.findViewById(R.id.security_email);

    View.OnClickListener emailListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String to = "";
            switch (v.getId()) {
            case R.id.secretary_email:
                to = getResources().getString(R.string.secretary_email);
                break;
            case R.id.cp_email:
            case R.id.vcp_email:
                to = getResources().getString(R.string.core_email);
                break;
            case R.id.exec_email:
                to = getResources().getString(R.string.exec_email);
                break;
            case R.id.tech_email:
                to = getResources().getString(R.string.tech_email);
                break;
            case R.id.pr_email:
                to = getResources().getString(R.string.pr_email);
                break;
            case R.id.marketing_email:
                to = getResources().getString(R.string.marketing_email);
                break;
            case R.id.events_email:
                to = getResources().getString(R.string.events_email);
                break;
            case R.id.decor_email:
                to = getResources().getString(R.string.decor_email);
                break;
            case R.id.admin_email:
                to = getResources().getString(R.string.admin_email);
                break;
            case R.id.security_email:
                to = getResources().getString(R.string.security_email);
            }
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SENDTO);
            intent.setType("text/plain");
            intent.setData(Uri.parse("mailto:" + to));
            intent.putExtra(Intent.EXTRA_EMAIL, to);
            try {
                startActivity(Intent.createChooser(intent, "Send Email"));
            } catch (Exception e) {
                Toast.makeText(getActivity(), e.getStackTrace().toString(), Toast.LENGTH_SHORT).show();
            }
        }
    };

    secretary.setOnClickListener(emailListener);
    cp.setOnClickListener(emailListener);
    vcp.setOnClickListener(emailListener);
    exec.setOnClickListener(emailListener);
    tech.setOnClickListener(emailListener);
    pr.setOnClickListener(emailListener);
    marketing.setOnClickListener(emailListener);
    events.setOnClickListener(emailListener);
    decor.setOnClickListener(emailListener);
    admin.setOnClickListener(emailListener);
    security.setOnClickListener(emailListener);

    return view;
}

From source file:com.hch.beautyenjoy.tools.IntentUtils.java

/**
 * Send message/*  w ww . ja  v  a 2s  .co  m*/
 */
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);
    ComponentName componentName = intent.resolveActivity(context.getPackageManager());
    if (componentName != null) {
        context.startActivity(intent);
    }
}

From source file:com.twolinessoftware.smarterlist.activity.BaseNavigationActivity.java

private void sendFeedbackEmail() {
    Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
            Uri.fromParts("mailto", "feedback@smarterlistapp.com", null));
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_subject));
    startActivity(Intent.createChooser(emailIntent, getString(R.string.email_send_text)));

}