uknownothingsnow / CircleProgress

CircleProgress, DonutProgress, ArcProgress
3.81k stars 921 forks source link

ArcProgress.setProgress can generate java.lang.NumberFormatException #141

Open giovdain opened 3 years ago

giovdain commented 3 years ago

bugged because under some locale, decimal format returns a string not parseable by Float.valueOf that always wants the . as decimal separator

crashing line this.progress = Float.valueOf(new DecimalFormat("#.##").format(progress));

fix this.progress = (float)Math.round(progress * 100.0f) / 100.0f;