GoogleMap Web版androidでの応用

1937 ワード


Html部分:
google.html
 
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0px; padding: 0px }
  #map_canvas { height: 100% }
</style>
<script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?v=3&sensor=false">
</script>
<script type="text/javascript">
  function initialize(latitude,longitude) {
    alert(latitude+","+longitude);
    var latlng = new google.maps.LatLng(latitude,longitude);
    var myOptions = {
      zoom: 15,
      center: latlng,
      disableDefaultUI: true,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
   var image = 'iconmarka.png';
   var beachMarker = new google.maps.Marker({
      position: latlng, 
      map: map,
      icon: image
  }); 
  }
</script>
</head>
<body>
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>

 
Javaセクション:
 
 //             
 double latitude = tmppicinfo.getLatitude(); 
 double longitude = tmppicinfo.getLongitude();  
/**   RL   **/
  WebView webmap = (WebView) findViewById(R.id.webmap);
  webmap.getSettings().setJavaScriptEnabled(true);
  webmap.loadUrl(weburl);// google.html  assets   ,weburl google.html URI
  webmap.setWebViewClient(new MyWebViewClient(latitude, longitude));