在 Android 上显示 Jsoup 元素的更快方法

发布于 2025-01-01 20:45:37 字数 223 浏览 3 评论 0原文

有没有更快的方法将 Jsoup 元素显示到 Android 应用程序上?

我正在开发的应用程序使用 jsoup 下载并解析页面,获取我想要显示的页面的一部分,编辑其中的某些部分,然后将该部分的元素转换为 HTML 并将其显示到 web 视图上。

有没有更快的方法来做到这一点?我注意到从元素获取 HTML 需要很长时间。有没有办法直接将元素添加到 webview 或其他东西上而无需获取其 HTML?

Is there a faster way to display Jsoup elements onto android apps?

The app I am working on download and parses a page using jsoup, gets a section of the page I want to display, edit some parts of it, then converts that section's element to HTML and displays it onto a webview.

Is there a faster way to do this? I noticed that getting the HTML from the elements takes a long time. Is there a way to directly add the element onto webview or something else without having to acquire its HTML?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迟月 2025-01-08 20:45:37

不幸的是,您遇到的是尝试在移动设备上进行(相对)复杂的处理的副作用。请记住,您的应用可能会安装在资源不足的设备上,而类似的东西会导致低评级

话虽如此,您通常希望在服务器端执行这些复杂的转换,然后将(格式化的)数据发送到设备 - 例如,您可以在 WebView 中呈现这些数据。没有固有的方法可以让 jsoup 更快 - 您仅受设备资源的限制(正如您已经发现的那样)出去)。

Unfortunately, what you're experiencing is a side effect of trying to do (relatively) complex processing on a mobile device. Keep in mind that your app may be installed on low-resource devices and stuff like this screams low ratings.

Having said that, you usually want to do these sort of complex transformations on the server side, and then send the (formatted) data to the device - which you can then render in your WebView, for example. There is no inherent way to make jsoup faster - you're only limited by the resources of your device (as you already found out).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文