首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android中通过邮件实现多值

在android中通过邮件实现多值
EN

Stack Overflow用户
提问于 2011-04-14 13:37:57
回答 1查看 459关注 0票数 0

我想通过EXTRATEXT intent...But发送多个值,但我做不到。

代码:

代码语言:javascript
复制
public void onClick(View view) {
                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
                emailIntent.setType("plain/text"); 
                String mailid="luckshay_sm@yahoo.co.in"; 




  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{mailid}); 
  emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Delivery Request"); 
  emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My address is   "+edittext.getText().toString());                             

 emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,  "My phone number is "+edittext1.getText().toString());
                startActivity(Intent.createChooser(emailIntent, "Send mail...")); 
               }

           });

           Now the problem is that only phone number appears but the address doesnt appear..ie. its taking the second EXTRA_TEXT and not the first one.:(

我想用EXTRA_TEXT....Is传递一些5-6的值,这是可能的吗?

EN

回答 1

Stack Overflow用户

发布于 2011-04-14 13:46:50

如果你使用2 (android.content.Intent.EXTRA_TEXT),它会取最后一个。因此,您可以使用下面的地址和电话号码代码作为putextra

代码语言:javascript
复制
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My address is   "+edittext.getText().toString()+"\n My phone number is "+edittext1.getText().toString()); 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5659000

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档