Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 按钮未执行电子邮件意图_Android_Android Intent - Fatal编程技术网

Android 按钮未执行电子邮件意图

Android 按钮未执行电子邮件意图,android,android-intent,Android,Android Intent,我是android开发的新手。这是我的应用程序代码。我一直试图使按钮初始化和电子邮件应用程序的意图,但它不工作。我在下面分享了我的文件。请帮忙 安卓清单 <activity android:name=".ordernow" android:label="Order Details"> <intent-filter> <action android:name="android.intent.action.SENDTO" />

我是android开发的新手。这是我的应用程序代码。我一直试图使按钮初始化和电子邮件应用程序的意图,但它不工作。我在下面分享了我的文件。请帮忙

安卓清单

<activity android:name=".ordernow" android:label="Order Details">
    <intent-filter>
        <action android:name="android.intent.action.SENDTO" />
        <data android:scheme="mailto" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>

</activity>
请帮我找到那辆车。除了解释之外,还将介绍github的一个好的要点和正确的代码行

应用程序出现故障

如果您的意思是应用程序正在崩溃

事实上,该应用程序只是一次又一次地运行我的活动,而不改变状态

首先,从ordernow元素中删除。如果你正在编写一个电子邮件应用程序,这将是合适的,而事实似乎并非如此


在这一点上,您可能会发现,当您单击按钮时,什么也没有发生。这表示您的设备上没有支持mailto:Uri操作的应用程序。您可能需要安装或配置电子邮件客户端才能使其正常工作。

最终代码如下所示

活动\u ordernow.xml布局

<Button
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:textAllCaps="true"
    android:id="@+id/email_form"
    android:text="Get Quote"
    android:onClick="getQuote" />
<Button
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:textAllCaps="true"
    android:id="@+id/email_form"
    android:text="Get Quote"
    android:onClick="getQuote" />

建议您使用此库:

请详细解释它不工作的含义。@Commonware我没有打开电子邮件应用程序。应用程序出现故障。错误:未能在表面0x7f593eca4200上设置EGL_交换_行为,错误-EGL_成功事实上,应用程序只是在不更改状态的情况下反复运行我的活动。当我删除应用程序时,应用程序会崩溃,并在模拟器屏幕上显示消息“不支持的操作”。我运行的是android 5.1 FYIThanks,删除工作非常出色。我不得不在墙上设置一个邮箱emulator@omukiguy:在设置有效帐户之前,某些邮件应用不会启用其mailto:one之类的活动。毕竟,没有帐户,mailto:activity实际上不能做任何事情。
<Button
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:textAllCaps="true"
    android:id="@+id/email_form"
    android:text="Get Quote"
    android:onClick="getQuote" />
public void getQuote (View view){

        String addresses = "omukiga@omukiga.com";
        String subject = "Get Quote Online";
        String body = "This is the body text for me";

        //Compose email to send to Intraline
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        //For only email apps to handle the information Also Experiment about using whatsapp
        intent.setData(Uri.parse("mailto:"));
        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "example@example.com" });
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.putExtra(Intent.EXTRA_TEXT, body);
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        }

}