开发者

search for location using maps api android sdk

I am lacking the knowledge of how to search for a location using an EditText and button when the person enters the longitude and latitude or even just an address into the EditText section an pushes the Button I want the map to go to that loca开发者_C百科tion. If anyone has any info on how to do so or even a tutorial it would be much appreciated.

thanks.


String uri = "geo:"+ latitude + "," + longitude;

startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));

or with an adress:

geo:latitude,longitude
geo:latitude,longitude?z=zoom
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city

http://developer.android.com/guide/appendix/g-app-intents.html

For instance:

Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);

For navigation:

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + location)); 
startActivity(i);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜