I am using Android Map V3 in my application and i already know that there is a bug in Kit-Kat version where the chromium kit throws up this error - nativeOnDraw failed; clearing to background color and doesn't draw the map.
I already had tried the list of solutions given at WebView Rendering Issue in Android KitKat (disable hardware acceleration, change the background color), but none of them worked so far.
Further i also did a few searches in other forums and they have proposed a workaround by setting the borderRadius of the webview to > 0.
My question is how do i set the border radius to the webview? I presume that this is done via a separate js file, but guess i am having some trouble in putting all the pieces together.
Between i see this issue has been there right from the start of Kit-Kat. Haven't they fixed this still?
Note: The view loads a map for a second before going back to the blank state.
My HTML-JS code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0}
#map-canvas { height: 100% }
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_KEY"></script>
var map;
<script type="text/javascript">
function initialize()
{
var latitude = 0;
var longitude = 0;
if (window.android)
{
latitude = window.android.getLatitude();
longitude = window.android.getLongitude();
}
var myLatLng = new google.maps.LatLng(latitude,longitude);
var mapOptions = {zoom: 20, center: myLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP};
map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
In my class, i add the above html code (which is saved in the assets folder) to the webview.
map = (WebView) rootView_Parent.findViewById(R.id.mapview);
map.loadUrl("file:///android_asset/mapurl.html");
map.getSettings().setJavaScriptEnabled(true);
map.setLayerType(View.LAYER_TYPE_SOFTWARE, null);