[英]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.