简体   繁体   中英

Create bitmap from webView/Cordova

I have a page loaded in webview/Cordova.
Is it possible to get bitmap object of a picture loaded in that webview with id/class XYZ ?

I know it is possible to pass the image url to java and load Image there and create bitmap object out of it. But in that case image has to be loaded again.

Finally I got a workaround for this problem.
It has 3 steps

1.convert image in Webview into base64String
( This link will help you to do that.)

2.Pass base64String to java using cordova bridge.

3.Decode base64string in java to create a bitmap
( This link will help you to do that.)

android 2.3可以从缓存中获取image_file,4.0 +,没用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM