发送电子邮件的表单,Android

发送电子邮件的表单,Android,android,email,android-intent,Android,Email,Android Intent,这个主题在这里和互联网上都有很好的文档记录,但我仍然有一个问题,我尝试了各种代码 我的代码看起来很好,但按下“发送”按钮时没有执行任何操作 我已将ReportProblemMail活动添加到清单文件中,是否缺少任何权限 非常感谢你的帮助 reportproblem.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/a

这个主题在这里和互联网上都有很好的文档记录,但我仍然有一个问题,我尝试了各种代码

我的代码看起来很好,但按下“发送”按钮时没有执行任何操作

我已将ReportProblemMail活动添加到清单文件中,是否缺少任何权限

非常感谢你的帮助

reportproblem.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="To : "
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/to_edit_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textEmailAddress" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Subject : "
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/subject_edit_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Message : "
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/message_edit_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:inputType="textMultiLine"
        android:lines="5" />

    <Button
        android:id="@+id/send_email_button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Send" />

</LinearLayout>
ReportProblemMail.java

烤面包

@Override
            public void onClick(View v) {

                Toast.makeText(getApplicationContext(), 
                        "Button is clicked", Toast.LENGTH_LONG).show();

              String to = mTo.getText().toString();
              String subject = mSubject.getText().toString();
              String message = mMessage.getText().toString();
清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="burger.van"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="burger.van.SplashScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


            </intent-filter>



        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.van.MainActivity" >
        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.van.AboutActivity" >
        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.van.SubmitVanActivity" >
        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.vanlocator.ReportProblemActivity" >
        </activity>



        <activity
            android:label="@string/app_name"
            android:name="burger.van.ReportProblemMail" >
        </activity>



    </application>

</manifest>


您的按钮是否处理了单击?如果在OnClickListener中显示祝酒词,它是否有效?我看不出你的代码有错误。。。您不需要添加权限,因为“虽然您的应用程序正在设备上利用消息传递功能,但它不需要拥有任何此类权限。这是因为应用程序本身并不直接发送消息。”您正在emulator或real device中进行测试?您的代码在我这方面运行良好。我建议您尝试重建项目或进行一些同步。@Adrencierdan我添加了一个toast,但它似乎没有注册。好的,现在尝试用Xml(android:onClick=“sendEmail”)将其添加到您的按钮中,并编写一个方法public void sendEmail(视图v){//将您的toast放在这里}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="burger.van"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="burger.van.SplashScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


            </intent-filter>



        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.van.MainActivity" >
        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.van.AboutActivity" >
        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.van.SubmitVanActivity" >
        </activity>

        <activity
            android:label="@string/app_name"
            android:name="burger.vanlocator.ReportProblemActivity" >
        </activity>



        <activity
            android:label="@string/app_name"
            android:name="burger.van.ReportProblemMail" >
        </activity>



    </application>

</manifest>