Since point1.longitude Double, you should use this
String.valueOf(point1.latitude); Intent(android.content.Intent.ACTION_VIEW,Uri.parse("google.navigation:q="+String.valueOf(point1.latitude)+","+String.valueOf(point1.longitude)+";"+String.valueOf( point2.latitude)+","+String.valueOf(point2.longitude)));
Or you can use it, but anyway.
point1.toString().replace("lat/lng: (", "").replace(")", "")
point1.toString () result: "lat / lng: (44.871709, -0.505704)", delete "lat / lng: (" and ")". then you can get the result you want.
Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr="+point1.toString().replace("lat/lng: (", "").replace(")", "")+"&daddr="+point2.toString().replace("lat/lng: (", "").replace(")", "")));
Or you can try this
Uri uri = Uri.parse("http://maps.google.com/mapssaddr="+point1.toString().replace("lat/lng: (", "").replace(")", "")+"&daddr="+point2.toString().replace("lat/lng: (", "").replace(")", "")); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent);
Hope this helps you.
source share