2011-06-04 22 views
0

我構建了一個包含許多地址的應用程序。用戶可以在列表視圖中選擇一個地址。這應該自動顯示用戶從用戶當前位置到該地址的方向。自動通過Intent進行指示

String uri = "geo:"+ selectedAddress.getLat+","+getLng(); 
StartActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(uri))); 

我知道所有這一切是顯示指定的合作社的位置。

我該如何去顯示用戶當前位置的位置指示?

+0

我不認爲你可以;如果您查看[此列表](http://developer.android.com/guide/appendix/g-app-intents.html),您會看到Google地圖唯一可用的意圖是如何顯示位置,你在你的代碼中做了什麼。 – Frxstrem 2011-06-04 15:26:46

回答

1

我該如何去顯示用戶當前位置的位置指示?

由於@Frxstrem指出,沒有記錄在案,並支持Intent帶來了方向。

1

要求的地方用戶並執行以下操作方法:

String place="";//user gives the place. 
String url = "http://maps.google.com/maps?daddr="+place; 
Intent drn = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url)); 
startActivity(drn); 

谷歌會自動把當前用戶位置爲出發點,並指示