October 2017
Intermediate to advanced
294 pages
6h 49m
English
In our first plain implementation of our custom view, we've created a method to set the data points but we couldn't modify or update the data. Let's implement some quick changes to be able to dynamically add points. In this implementation, we adjusted the values to the 0 to 1 scale directly on the setDataPoints() method. As we'll provide a method to add new data values, we might get values outside the original minimum and maximum values, invalidating the scale we calculated before.
Let's first store the data in a collection instead of an array, so we can easily add new values:
private ArrayList<Float> dataPoints;public void setDataPoints(float[] originalData) { ArrayList<Float> array = new ArrayList<>(); for (float data ...Read now
Unlock full access