要在Android应用中显示两个标记点之间的路径,可以使用Google Maps API。下面是一个使用Google Maps API绘制两个标记点之间路径的示例代码:
implementation 'com.google.android.gms:play-services-maps:17.0.0'
 
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback {
    private GoogleMap googleMap;
    private MapView mapView;
    private Marker marker1, marker2;
    private Polyline polyline;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // 初始化地图
        mapView = findViewById(R.id.mapView);
        mapView.onCreate(savedInstanceState);
        mapView.getMapAsync(this);
    }
    @Override
    public void onMapReady(GoogleMap map) {
        googleMap = map;
        // 在地图上添加标记点
        LatLng point1 = new LatLng(37.7749, -122.4194);
        LatLng point2 = new LatLng(34.0522, -118.2437);
        marker1 = googleMap.addMarker(new MarkerOptions().position(point1).title("Marker 1"));
        marker2 = googleMap.addMarker(new MarkerOptions().position(point2).title("Marker 2"));
        // 移动地图视图,使标记点都可见
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        builder.include(marker1.getPosition());
        builder.include(marker2.getPosition());
        googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 100));
        // 绘制路径
        PolylineOptions polylineOptions = new PolylineOptions()
                .add(point1)
                .add(point2);
        polyline = googleMap.addPolyline(polylineOptions);
    }
    @Override
    public void onResume() {
        super.onResume();
        mapView.onResume();
    }
    @Override
    public void onPause() {
        super.onPause();
        mapView.onPause();
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        mapView.onDestroy();
    }
    @Override
    public void onLowMemory() {
        super.onLowMemory();
        mapView.onLowMemory();
    }
}
在上面的代码中,我们使用了MapFragment来初始化地图,并在地图上添加了两个标记点。然后,我们使用PolylineOptions来创建一个Polyline对象,并将其添加到地图上。
请注意,上面的代码假设你已经在AndroidManifest.xml文件中添加了Google Maps API密钥。你还需要在AndroidManifest.xml中添加以下权限:
 
 
这样就可以在Android应用中显示两个标记点之间的路径了。运行应用程序后,你将看到地图上显示了两个标记点,并绘制了连接它们的路径。