小编Bry*_*yan的帖子

将编辑文本字段中的文本添加到电子邮件中

我有一个应用程序,想要联系我们,用户输入他们的姓名,地址,电话号码和评论部分.然后他们会点击撰写邮件按钮,它会自动将文本加载到电子邮件中.已经解决了一些代码但不确定如何将编辑文本中的文本添加到我的电子邮件消息中.任何人对我如何做到这一点都有任何建议.我已经附加了我的xml文件和我的java文件中的代码.

 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;

 public class Contactform extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contactform);

    Button email = (Button) findViewById(R.id.button30);
    email.setOnClickListener(new View.OnClickListener()  {

        @Override
        public void onClick(View v){
            //TODO Auto-generated method stub
            Intent email = new Intent(android.content.Intent.ACTION_SEND);

            /* Fill it with Data */
            email.setType("plain/text");
            email.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"ladsoffice@lads-to-leaders.org"});
            email.putExtra(android.content.Intent.EXTRA_SUBJECT, "Lads to Leaders/Leaderettes Questions and/or Comments");
            email.putExtra(android.content.Intent.EXTRA_TEXT, "Sent from the Lads to Leaders/Leaderettes Android App");

            /* Send it …
Run Code Online (Sandbox Code Playgroud)

email android email-client android-edittext

2
推荐指数
1
解决办法
7425
查看次数

标签 统计

android ×1

android-edittext ×1

email ×1

email-client ×1