Ouvrir un itinéraire sur Google Maps a partir d'une Intent
Bonjour a tous,
Tout est dit dans le titre :D
Je souhaiterai ouvrir un itinéraire, de plusieurs adresses saisie dans plusieurs EditText
Cela fonctionne actuellement avec une seule adresse, mais je ne trouve pas comment en rajouter
N'hésitez pas, tout ce qui vous passe par la tête est bon a prendre ;)
Merci d'avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn_search = findViewById(R.id.btn_search);
btn_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EditText et_location1 = findViewById(R.id.et_location1);
String str_locone = et_location1.getText().toString();
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4192?q=" + Uri.encode(str_locone));
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
}); |