Is there a way to set an address in an application so when it is clicked it automatically opens it in Google Maps? I may end up implementing Maps into my application but it is a simple reference app simply to find the address.
You do this via an Intent.
The various URI formats you can use are:
geo:latitude,longitude
geo:latitude,longitude?z=zoom
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city
See http://developer.android.com/guide/appendix/g-app-intents.html for more details.
You build the URI, and pass it to the intent, like this.
String uri = "geo:latitude,longitude";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
You might also want to make sure that the Google Maps application is actually installed on the device, described here, so you don't run afoul of devices that don't have Google Maps installed (Amazon Kindle, Barnes & Noble Nook, etc.).
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