Created
November 29, 2017 19:38
-
-
Save csabafarkas/9379a5a769d263f9ba548f1be641784b to your computer and use it in GitHub Desktop.
Build Uri with maps data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClickOpenAddressButton(View v) { | |
String address = "Cork Ireland"; | |
Uri.Builder builder = new Uri.Builder(); | |
builder.scheme("geo") | |
.path("0,0") | |
.appendQueryParameter("q", address); | |
Uri addressUri = builder.build(); | |
showMap(addressUri); | |
} | |
private void showMap(Uri mapUri) { | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(mapUri); | |
if (intent.resolveActivity(getPackageManager()) != null) { | |
startActivity(intent); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment