2011-11-18 29 views
1

我知道,我可以用這個做到這一點:可以在導航器上顯示啓動Google地圖的兩個座標之間的路線嗎? (編程)

  Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
      Uri.parse("http://maps.google.com/maps?saddr=39.45798340851973,-0.3835865820296931&daddr=39.44353524837272,-0.3760334814437556"));    
      startActivity(intent); 

但我需要刪除的對話框,並forze它推出領航¿怎麼辦呢?

我知道我可以forze對話與intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");

打開Goog​​leMap的應用程序,但我需要的正好相反,啓動導航。

回答

1

嘗試

Intent i = new Intent(); 

i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity")); 
i.setAction("android.intent.action.VIEW"); 
i.addCategory("android.intent.category.BROWSABLE"); 
Uri data = Uri.parse("http://www.google.com"); 
i.setData(data); 

startSubActivity(i, 2); 
+0

ActivityNotFoundException:無法找到明確的活動類{com.google.android.browser/com.google.android.browser.BrowserActivity};你有沒有在你的AndroidManifest.xml中聲明這個活動? – NullPointerException

+0

也ContentURI不存在 – NullPointerException

+0

哎呀,試試我的更新版本 – Michele

相關問題