Closed abby1602 closed 3 years ago
First you need to clear previous sections:
speedometer.clearSections()
Then add new ones:
val firstSectionEndPoint = .65f // Get from json.
val secondSectionEndPoint = .95f
val thirdSectionEndPoint = 1f
speedometer.addSections(
Section(0f, firstSectionEndPoint , Color.GREEN),
Section(firstSectionEndPoint, secondSectionEndPoint, Color.ORANGE),
Section(secondSectionEndPoint, thirdSectionEndPoint, Color.RED)
)
Don't try to edit your existing sections, it may leads to conflict exception.
I have to set the value dynamically from json to speedview
For example i am getting the value for green orange red as 65 , 95, 100 .
Then how to set the sections accordingly
I am getting the values from json so it will change accordingly.
PLease help me out in this