WEB开发网
开发学院手机开发Android 开发 Android 数据库与MapView总结 阅读

Android 数据库与MapView总结

 2010-11-05 00:54:34 来源:WEB开发网   
核心提示:}}private GeoPoint getGeoByAddress(String strSearchAddress){GeoPoint gp = null;try{if(strSearchAddress!=""){Geocoder mGeocoder01 =new Geocoder(EX10_06

}

}

private GeoPoint getGeoByAddress(String strSearchAddress)

{

GeoPoint gp = null;

try

{

if(strSearchAddress!="")

{

Geocoder mGeocoder01 =

new Geocoder(EX10_06_04.this, Locale.getDefault());

List

lstAddress =

mGeocoder01.getFromLocationName(strSearchAddress, 1);

if (!lstAddress.isEmpty())

{

Address adsLocation = lstAddress.get(0);

/* 1E6 = 1000000*/

double geoLatitude = adsLocation.getLatitude()*1E6;

double geoLongitude = adsLocation.getLongitude()*1E6;

gp = new GeoPoint((int) geoLatitude, (int) geoLongitude);

}

}

}

catch (Exception e)

{

e.printStackTrace();

}

return gp;

}

/**

* 更新MapView地图

* @param gp GeoPoint地理坐标对象

* @param mv 查询的数据的字段名称

* @param zoomLevel 放大层级

* @param setSatellite 是否显示卫星地图

*/

public static void refreshMapViewByGeoPoint

(GeoPoint gp, MapView mv, int zoomLevel, boolean setSatellite)

{

try

{

mv.displayZoomControls(true);

MapController mc = mv.getController();

mc.animateTo(gp);

mc.setZoom(zoomLevel);

mv.setSatellite(setSatellite);

}

catch(Exception e)

{

e.printStackTrace();

}

}

/**

* 在地图上显示Overlay图片

* @param gp GeoPoint地理坐标对象

*/

private void showImageOverlay(GeoPoint gp)

{

/* 设置Overlay */

GeoPointImageOverlay mLocationOverlay01;

mLocationOverlay01 = new GeoPointImageOverlay

上一页  20 21 22 23 24 25 26 27 28 29 30  下一页

Tags:Android 数据库 MapView

编辑录入:coldstar [复制链接] [打 印]
赞助商链接