Android Code Snippet Set maximum progress for Progressbar

Pooya1

Active Member
Licensed User
Hi
With below code you can define maximum progress for Progressbar :cool:
I found it hardly :mad:

B4X:
Sub SetMaximumProgressbar(Pb As ProgressBar,Value As Int)
    Dim CB1 As JavaObject = Pb
    CB1.RunMethod("setMax",Array(Value))
End Sub
 

Syd Wright

Well-Known Member
Licensed User
I don't think there will often be a need to change the Max value above 100, unless you want a very accurate progress indicator whereby for example the resolution is one horizontal pixel. Setting the value higher than the number of screen pixels is of no use. The effect simply won't be visible.
Normally it's just a matter of calculating the value versus the expected maximum.
For example if the maximum is 25000 then the Progressbar value (P) will be P = 25000 / X * 100.
X can then be between 0 and 25000.
 
Top