简体   繁体   English

有没有办法以字符串或HTML格式存储Android活动屏幕的整个文本?

[英]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.

相关问题 有没有一种方法可以使用CSS存储和显示HTML以在Android中实现文本格式? - Is there a way to store and display HTML with CSS to achieve text formatting in Android? Android:以字符串形式存储文本 - Android : Store text in string Android透明活动不会覆盖整个屏幕 - Android Transparent Activity doesn't cover the whole screen 在android中存储文本的优化方式 - Optimized way to store text in android Android - 在活动上布局一些文本的最佳方式 - Android - Best way to layout some text on an activity 在 Android 中创建登录屏幕/活动的正确方法是什么? - What is the correct way of creating a login screen/activity in Android? 在Android应用程序中存储文本数据的最佳方法? - Best way to store text data in an android app? 有什么办法可以使用firebase跟踪android中非活动类的屏幕? - Is there any way track screen for non activity classes in android using firebase? 有什么方法可以从主屏幕上区分Android Activity onResume吗? - Is there any way to distinguish between an Android Activity onResume from the home screen? Android新活动,每个屏幕的新布局,还是有更好/更清洁的方式? - android new activity, new layout for every screen or is there a better/cleaner way?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM