【发布时间】: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);
}
请帮助我找到解决方案。提前致谢。
【问题讨论】: