开发者

API call to Android browser to obtain rendered web page as image?

开发者 https://www.devze.com 2023-03-02 20:33 出处:网络
Is there any way to make a call to the Android web browser, that ships with every phone, to render a web page and return it to my program as an image?

Is there any way to make a call to the Android web browser, that ships with every phone, to render a web page and return it to my program as an image?

This would be hidden from the user. It would not command the Android browser to open itself up on the user's screen and display that web page. Instead, it would be feeding my p开发者_如何学Gorogram rendered web pages as images, and the user would only see my program and not the Android browser.

Thank you.


You don't need to use the system browser, the HTML rendering capabilities are available by the WebView class. It also has a method WebView.capturePicture(), which you can use to obtain an image of the whole rendered website.

However, it could be tricky to drive the WebView into rendering the web page while it is not visible. It must be attached as some view to the current Activity to start loading pages and render them, however its maybe possible to have it hidden in the background when attaching more than one view to a container view like ViewGroup.

0

精彩评论

暂无评论...
验证码 换一张
取 消