【问题标题】:How can i include a content into the email body before sending it out in android?在将内容发送到 android 之前,如何将内容包含到电子邮件正文中?
【发布时间】:2014-07-31 18:19:16
【问题描述】:

大家好,我如何在将内容发送到 android 之前将其包含到电子邮件正文中。有一个静态方法 AppLogHelper.tail()。这将返回 logCat 文件的最后 50 行,我需要将此日志内容包含在电子邮件正文中,然后再发送出去。任何人都可以请帮助我。

我的静态方法返回的logcat是:

public static String tail() {
    if(null == AppLogHelper.getInstance()) 
        return("");
    StringBuilder sBuilder = AppLogHelper.getInstance().readLastNLog( LOG_TAIL_LINES);
    if( null != sBuilder ) 
        AppLogHelper.i("AppLogHelper", "getLogTail() sucessful");
    return sBuilder.toString();
}

发送邮件的按钮是:

public void onEmail(View v) {
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);  
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"support@slice.com"});
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");  
    emailIntent.setType("plain/text");  

    startActivity(emailIntent);   
}

请帮助我找到解决方案。提前致谢。

【问题讨论】:

    标签: android email


    【解决方案1】:

    你可以试试这个,

    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Test");
    

    希望对你有帮助..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-19
      • 1970-01-01
      • 2012-05-25
      • 1970-01-01
      • 2015-07-07
      • 1970-01-01
      • 2019-11-27
      • 1970-01-01
      相关资源
      最近更新 更多