列表视图内容电子邮件 [英] Listview Content Email

查看:31
本文介绍了列表视图内容电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ListView 和两个 TextViews 作为结果.一个是结果,另一个是描述.我的 Listview 包含 10 行.问题是如何使用 android 默认邮件编辑器通过电子邮件发送内容?当用户按下电子邮件按钮时,Listview 的内容复制到邮件剪贴板

I have a ListView with two TextViews as result.One is result and other is description. My Listview contains 10 rows .The question is that how can I E-mail the content using android default mail composer.? When user press the email button, the contents of the Listview copy to the mail clipboard

推荐答案

String getvalue;
for(int i =0;i<getListView.getChildCount();i++){
LinearLayout layout = getListView.getChildAt(i);

getvalue = layout.getChildAt(1).getText();

}

mailbutton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {

             Intent email = new Intent(Intent.ACTION_SEND);
          email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});

          email.putExtra(Intent.EXTRA_SUBJECT, subject);
          email.putExtra(Intent.EXTRA_TEXT, getvalue);

          //need this to prompts email client only
          email.setType("message/rfc822");

          startActivity(Intent.createChooser(email, "Choose an Email client :"))
            }
        });

这篇关于列表视图内容电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆