Android的电子邮件意图 [英] Android Email Intent

查看:142
本文介绍了Android的电子邮件意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了两个按钮。一打开撰写短信意图和其他打开撰写电子邮件的意图。短信意图工作正常,但邮件按钮犯规响应。香港专业教育学院创建了一个categorychooser但那不露面....直到我点击短信按钮

I've set up two buttons. One opens the compose sms intent and the other opens the compose email intent. The sms intent works fine but the email button doesnt respond. Ive created a categorychooser but that doesnt show up....UNTIL I click the sms button

这是我的code

case R.id.button2:
    {
        String phoneNumber = "xxxxxxxxxx";``
        Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
        smsIntent.addCategory(Intent.CATEGORY_DEFAULT);
        smsIntent.setType("vnd.android -dir/mms-sms");
        smsIntent.setData(Uri.parse("sms:"+phoneNumber));
        startActivity(smsIntent);


    }
    case R.id.button3:
    {
        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"xxxxxxxx@gmail.com"});
        emailIntent.setType("plain/text");
        startActivity(Intent.createChooser(emailIntent, "Send email..."));

    }

任何想法?

推荐答案

尽量把打破; 每个后情况 XXX {}​​

try to put break; after each case xxx {}

这篇关于Android的电子邮件意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆