i want to implement the weighting of graph with my custom weighting in android studio. i try to make custom weighting based on this structure https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/weighting/FastestWeighting.java
and i create new class that extends GraphHopper like this
class MyGraphHopper extends GraphHopper {
@Override
public Weighting createWeighting(HintsMap hintsMap, FlagEncoder encoder, Graph graph) {
String weightingStr = hintsMap.getWeighting().toLowerCase();
if ("my_custom_weighting".equals(weightingStr)) {
return new MyCustomWeighting(encoder);
} else {
return super.createWeighting(hintsMap, encoder, graph);
}
}
}
but when i try to use my custom weighting in another activity like this
GHRequest req = new GHRequest(fromLat, fromLon, toLat, toLon)
.setAlgorithm(Algorithms.DIJKSTRA_BI)
.setWeighting(“my_custom_weighting”);
Its always weighting null not suppoerted