问题
I have a route. Now, I want to find all nearby markets, for example, around that route. On web version, I use RouteBox library successfully. The problem is I can't use it in Google Map on Android, because it is a javascript library.
What can I do now? How can I use that library on Android or do I have a workaround way?
回答1:
You can call javascript from your App in Android. You will need to use JS Evaluator for Android (JSEA).
Just do something like:
jsEvaluator.callFunction(new JsCallback() {
@Override
public void onResult(final String result) {
// get result here
}
}, "functionName", "parameter 1", "parameter 2", 912, 101.3);
To call your javascript.
So, you can access the library that will allow you communicate your App with the RouteBoxer API. Just check it on Github for JSEA. It should allow you to use RouteBoxer as usual.
Hence, you will call the route from your App.
回答2:
As an alternative, you can also use a Java port of the RouteBoxer.js available here: https://code.google.com/p/routeboxer-java/
来源:https://stackoverflow.com/questions/23060477/how-to-use-routeboxer-js-for-google-map-on-android