Re: [android-developers] Android and web server connectivity
Hi,
I developed an app similar to yours in asp and mysql.
Use GoogleMapjavascript api for displaying locations.No need of xml parsing.
Approach:
First develop web application and convert in to Andriod webapp.
1)Display the location using Google Map java script Api.
get long lat values from mysql and store it in array Locations_Hospital.
pass this array(Locations_Hospital) to Map java script array .
Find syntax to embed php array syntax in var locations =[ embed ur php array of long lat ];
in asp i used var locations =[ <% Response.write MapAddrs %> ];
<!DOCTYPE html>
<html>
<head>
<title>
</title>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<LINK class=stylesheet href="css/style.css" type=text/css rel=stylesheet>
<link rel="stylesheet" type="text/css" href="css/googlemaps.css" />
</head>
<body>
<div id="map" style="width: 600px; height: 400px;"></div>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
<script type="text/javascript">
var locations =[ embed ur php array of long lat ];
// it is the array of location(long,lat)
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(17.4478104,78.5263305),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
</script>
2) load url using android webview.
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home