manifest里配置:
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.firstandroidapp.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
main.xml里:
<EditText
android:id="@+id/edit_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/edit_message"
android:inputType="text"
android:maxLength="10" >
</EditText>
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn"
android:onClick="sendMessage" >
</Button>
Activity.class里:
/* 发送Email */
EditText text = (EditText) findViewById(R.id.edit_message);
String message = text.getText().toString();
String[] email = new String[] { "goriranokimochi@msn.cn" };
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("message/rfc822");
intent.putExtra(android.content.Intent.EXTRA_EMAIL, email);
intent.putExtra(android.content.Intent.EXTRA_TITLE, "标题");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(android.content.Intent.EXTRA_TEXT, message);
startActivity(android.content.Intent.createChooser(intent,
"mail send..."));
但是无法发送mail。
希望厉害的前辈们能帮帮我。谢谢啦。