用户位置和目的地之间的错误启动方向

error launching direction between user location and destination

我正在尝试在用户位置和目的地之间创建目的地。目标坐标是从先前的 activity(具有列表视图)传递的。一切进展顺利,但不知何故目的地没有显示结果,只显示 lat/lng:(50.798844, -1.0889845)。我知道我缺少一些东西来完成这项工作。 谁能帮我。

谢谢

这就是我的意图

Bundle intent = getIntent().getExtras();

        if (intent !=null){
       int position = intent.getInt("position", 0);

          final LatLng  latlng = intent.getParcelable("log");

路线:

Intent intent1 = new Intent(Intent.ACTION_VIEW,
                        Uri.parse("http://maps.google.com/maps?saddr="+"&daddr="+latlng));

        // intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
       startActivity(intent1);}
        });

问题是由 toString() 函数引起的。

toString() returns lat/lng:(50.798844, -1.0889845) 而不是 50.798844, -1.0889845.

话虽这么说,你应该这样做:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?saddr="+"&daddr="+latlng.latitude+","+latlng.longitude));