'Setting Circular progressbar is not updating the progress
My Code is really simple and it has nothing fancy logic in it. I am just taking a value and trying to set the value. This value is coming from the a LiveData observer and calling invalidate menu option to update the menu item values.
so inside onPrepareOptionsMenu
/*---------- Sensor Connection---------------*/
sensorPowerProgressView = menu?.findItem(R.id.action_power)?.actionView?.findViewById(R.id.powerProgress)
sensorPowerProgressView?.apply {
max = 5
progress = sensorPower
Log.d("POWER_VALUE","Sensor=$sensorPower")
}
When I check, the Log is perfectly logging the correct values. Upon sensor disconnect, I am setting progress value to 0 but it is retaining the last value as is in the progress.
I seriously don't know what is going on. I've read some older posts that pointed out, there was a bug and they provide some solutions but none of those solutions were working out for me.
One person has suggested to set the value on post, same solution was suggested by my brother who is senior Android developer but it seems to work sometime and sometime it doesn't.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
