我跟随了24小时教科书并创建了一个Android应用程序,该应用程序应该启动Google地图并根据硬编码到应用程序中的纬度和经度坐标导航到特定位置。但是,当我启动应用程序并运行代码时,它会打开Google地图或Google地球,并始终默认使用我当前的位置。我如何阻止它做到这一点?使用Java覆盖Android手机上的默认位置
我试图让我的应用去特定的经度和纬度,但是当它启动Google地图或Google地球时,它总是默认为我当前的位置。 Java的代码如下:
Button mapButton = (Button) findViewById(R.id.button2);
mapButton.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View view) {
String geoURI = "geo:37.422,-122.0847z=23";
Uri geo = Uri.parse(geoURI);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, geo);
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
我如何得到它覆盖缺省位置,往我已经硬编码以上的坐标?
https://开头计算器.com/questions/3990110/how-to-show-marker-in-maps-launching-by-geo-uri-intent – neethu