Go to google maps app with a address

The first step, you put the packaget for google maps

private String PACKAGET_MAPS="com.google.android.apps.maps";

The seconds step, you put query for to search the address.

private String HTTP_MAPS = "http://maps.google.com/maps?q=";

The third step, you put intent

if (Utils.isPackageInstalled(PACKAGET_MAPS, getApplicationContext())) {
StringBuilder stringBuilder = new StringBuilder();
//query of google maps
stringBuilder.append(HTTP_MAPS);
//String with your address
stringBuilder.append(separtorWithPlus("yourAddress"));
stringBuilder.append(",+");
//string of City
stringBuilder.append((separtorWithPlus("City")));
//intent with Uri which has query with address and city
intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(stringBuilder.toString()));
startActivity(intent);
} else {
mShowMessage.showAlert(getResources().getString(
R.string.string_google_maps_uninstall));
}

Leave a Reply

Your email address will not be published. Required fields are marked *