【发布时间】:2014-05-27 09:03:30
【问题描述】:
我在应用开发中遇到了问题。单击按钮后,我可以打开具有用户当前位置的 Google 地图。
location_selection.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Location gpsLocation = appLocationService.getLocation(LocationManager.GPS_PROVIDER);
Location nwLocation = appLocationService.getLocation(LocationManager.NETWORK_PROVIDER);
if (gpsLocation != null) {
latitude = gpsLocation.getLatitude();
longitude = gpsLocation.getLongitude();
} else if(nwLocation != null) {
latitude = nwLocation.getLatitude();
longitude = nwLocation.getLongitude();
} else {
Toast hint = Toast.makeText(getApplicationContext(), "Please turn on GPS/Network", Toast.LENGTH_SHORT);
hint.show();
}
if(latitude != 0 && longitude != 0) {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q="+latitude+","+longitude));
startActivity(intent);
}
}
});
我想要做的是检索用户在打开谷歌地图后设置的标记的坐标和地址,并将这些数据返回到我的应用程序关闭谷歌地图。但我真的不知道该怎么做!
【问题讨论】:
标签: android google-maps maps marker