Best Practise to set data on Segment

Segment widget provides multiple way to set the data. Sometimes a wrong usage of API’s can lead to application performance degrade.

Use setData:

  1. When you want to set Initial data to segment.
  2. When you want to change complete data to segment.
  3. When you want to change multiple rows in segment.

Use setDataAt:

  1. When you want to modify a single row on a particular user action.

Note: use any index based API’s per user action. and do not use any index based API’s inside for loop.