Search code examples
androidgoogle-mapsgoogle-polyline

Do I need PolylineOptions?


I got confused. Do I need PolylineOptions? When should I use it? I tried searching everywhere but can't seem to find the answer I need, even in the docs. What is the concrete difference or advantage when I use PolylineOptions?

Thanks in advance.


Solution

  • PolylineOptions is a "Builder" pattern for creating a Polyline. Since some elements are mandatory to create a polyline, while others can be optional (or have a default). So the advantage of PolylineOptions is that you need it to create a polyline! After you create a Polyline (adding it to the map and retrieving it in the response value of the method), you no longer need the polyline options you used, but you directly use the polyline.

    Does this answer to your question? Do you need more info? I think that if you look at the examples on adding polylines, you get more clue of what you can do with it.