How to Set the Upper Range of a ProgressBar to the Maximum Range of a Light Sensor

For API Level 3 and greater

1. Get the Maximum Range of a Light Sensor and save it so a float named myMaxRange.

2. Set the Maximum Upper Range of a ProgressBar. Instead of setting the max range to 100, we would like to set it to the float named myMaxRange. However, since it is a float, you cannot save a float to an integer. You will need to convert it to an integer first. So, just set the max upper range to (int) myFloat

3. Compile and run!