[英]is there a way to store the whole text of an Android activity screen in a string or HTML format?
I have an activity within my application which displays the results of some calculation breakdown, I wanted to implement the functionality which would allow the user send the whole content of this screen by e-mail or at least be able to copy this content into the clipboard, I know I can use this snippet to send the e-mail: 我的应用程序中有一个活动,该活动显示一些计算明细的结果,我想实现该功能,该功能将允许用户通过电子邮件发送该屏幕的整个内容,或者至少能够将此内容复制到剪贴板中,我知道我可以使用此代码段发送电子邮件:
String subject = "subject";
String body = "body"; // I need to store the content of the activity here
Intent messageIntent = new Intent(android.content.Intent.ACTION_SEND);
String aEmailList[] = { "some@etmail.com" };
messageIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
messageIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
messageIntent.setType("text/html");
messageIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body.toString()));
startActivity(messageIntent);
any help would be much appreciated 任何帮助将非常感激
How does the text get put onto the screen in the first place? 首先如何将文本放到屏幕上?
Just edit the methods that are generating text and putting it on the screen to also append it to a StringBuilder
while its working then at the end you can call builder.toString()
and it will contain all of the same information. 只需编辑生成文本的方法并将其显示在屏幕上,然后将其附加到StringBuilder
,然后最后可以调用builder.toString()
,它将包含所有相同的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.