How can I open Google Maps(using Intents or adding Google Maps into my application) with address? I have the address, but I don't have latitude/longitude. How can I do it? Thank you.
Add a hyperlink to existing textSelect the text that you want to turn into a hyperlink, and right-click it. On the shortcut menu, click Hyperlink. In the Insert Hyperlink dialog, paste the link in the Address box and click OK.
use below code,
String map = "http://maps.google.co.in/maps?q=" + str_location;
// where str_location is the address string
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(map));
startActivity(i);
From my personal Code Library. ;)
public static Intent viewOnMap(String address) {
return new Intent(Intent.ACTION_VIEW,
Uri.parse(String.format("geo:0,0?q=%s",
URLEncoder.encode(address))));
}
public static Intent viewOnMap(String lat, String lng) {
return new Intent(Intent.ACTION_VIEW,
Uri.parse(String.format("geo:%s,%s", lat, lng)));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With