How do I find all the Points in a Path in Android?

后端 未结 2 737
后悔当初
后悔当初 2020-12-08 16:36

Awhile back I asked a question to see if I was able to find a pair of specific points in a path; however, this time I want to know if there is a way to know all points in a

2条回答
  •  半阙折子戏
    2020-12-08 17:08

    If you have created a Path that means that in some point of your code, you know the exact (Geo)point. Why don't you put this point(s) on a ArrayList or something similar?

    So for example before doing:

    path.lineTo(point.x, point.y);
    

    you can do:

    yourList.add(point);
    path.lineTo(point.x, point.y);
    

    And later you can get all your points from the ArrayList. Note you that you can take advantage of the Enhanced For Loop Syntax of ArrayList that execute up to three times faster.

提交回复
热议问题