标签:android class code c java tar
逻辑:将bitmap转化为Base64,通过调用HTML中的JS,显示到HTML中
(1)android代码
Bitmap bitmap = ....; //获取bitmap对象
webView.loadUrl("javascript:onSaveCallback(‘data:image/png;base64," + bitmaptoString(bitmap) + "‘)"); 调用JS显示
(2)Html代码
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<script type="text/javascript">
function
onSaveCallback(src){
window.hui.showMessage(src);
document.getElementById("test").src
= src;
}
</script>
</head>
<body>
<img id="test" src=""
onclick=""/>
</body>
</html>
android 在HTML中显示bitmap,布布扣,bubuko.com
标签:android class code c java tar
原文地址:http://www.cnblogs.com/lianghui66/p/3724862.html