[英]Java - How to navigate to a map url in android studio?
我有一个导航到带有特定链接的地图的按钮。 这是我的代码:
Intent open2 = new Intent(android.content.Intent.ACTION_VIEW);
open2.setData(Uri.parse("https://www.google.com.eg/maps/dir/''/point+90+mall+location/data=!4m5!4m4!1m0!1m2!1m1!1s0x145822591a17706b:0xc9f886adcffbb941?sa=X&ved=0ahUKEwiF5-KS6t3SAhWoLcAKHWI-CEoQ9RcIeTAM"));
startActivity(open2);
但是,当我从手机上单击时,它会转到地图。 但这给了我:
找不到起点
我该如何解决?
您使用了错误的地图查询字符串,请尝试以下操作:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?q=Point 90 Mall, Cairo Governorate"));
startActivity(intent);
通常使用此查询http://maps.google.com/maps?q=PLACE_NAME
,在其中您将PLACE_NAME
替换为Google地图的地名(或搜索字符串)。
此处提供更多信息: https : //developers.google.com/maps/documentation/android-api/intents
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.