Antwort

2

Mai, dies hilft Ihnen.

Beispiel: -

btn_click.setOnClickListener(new View.OnClickListener() { 
    @Override 
    public void onClick(View v) { 
     new Handler().postDelayed(new Runnable() { 
      @Override 
      public void run() { 
       Uri gmmIntentUri = Uri.parse("geo:0,0?q="); 
       Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); 
       mapIntent.setPackage("com.google.android.apps.maps"); 
       startActivity(mapIntent); 
      } 
     }, 1000); 
    } 
}); 
2

hinter diesem Code in Onclick listner

String uri = "http://maps.google.com/maps?saddr=" + sourceLatitude + "," + sourceLongitude + "&daddr=" + destinationLatitude + "," + destinationLongitude; 
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); 
startActivity(intent); 
+0

was sourceLatitude und Länge seiner zeigt Fehler @sagar Patel –

+0

Standort Breite hinzufügen und Longtitude –

+0

Wie Sir, ich weiß nicht –

0

String uri = "http://maps.google.com/maps?saddr=" + sourceLatitude + "" + sourceLongitude + "& DADDR =" + destinationLatitude + "" + destinationLongitude;

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); 

intention.setPackage ("com.google.android.apps.maps");

startActivity (Absicht);

Verwandte Themen