ValueChangePerSecond moves the bar of AnotherProgressBar but it does not change Value:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
AnotherProgressBar1.ValueChangePerSecond = -10
If FirstTime = True Then
Timer1.Initialize("Timer1", 100)
Timer1.Enabled = True
End If
End Sub
Sub Timer1_Tick
Dim val As Int
val = AnotherProgressBar1.Value
Log(val) 'value logged never changes
End Sub
Also the way the bar moves seems contrary to expectations.
If ValueChangePerSecond is positive then the bar shrinks, if negative then it grows.
The code below moves the bar from 50% to 25% at a rate of 10% per second and then 2.5 seconds later moves it back.
Negative numbers for change are invalid (and confusing).
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
AnotherProgressBar1.Value = 100
'AnotherProgressBar1.ValueChangePerSecond = -10 Dont Use This!
If FirstTime = True Then
Timer1.Initialize("Timer1", 100)
Timer1.Enabled = True
End If
End Sub
Sub Timer1_Tick
Dim val As Int = AnotherProgressBar1.Value
Log(val) 'value logged
AnotherProgressBar1.Value = AnotherProgressBar1.Value - 1 'Subtract your desired value
If AnotherProgressBar1.Value <= 0 Then
Timer1.Enabled=False
AnotherProgressBar1.Value = 0
AnotherProgressBar1.SetValueNoAnimation(0)
End If
End Sub
The code below moves the bar from 50% to 25% at a rate of 10% per second and then 2.5 seconds later moves it back.
Negative numbers for change are invalid (and confusing).