A bit late for the party. I prefer @ st0le's answer, but URLEncoder.encode(String s) deprecated with API 16. You also need to pass a second argument. Check out the answer below.
public static Intent viewOnMapA(String address) { try { return new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("geo:0,0?q=%s", URLEncoder.encode(address, "UTF-8")))); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; }
Fawzan
source share