Sub Globals
Dim Maximo As Int
Dim ProgressBar1 As ProgressBar
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
ProgressBar1.Initialize("ProgressBar1")
End Sub
Sub Button1_Click
Dim fileliste As List
fileliste = File.ListFiles(File.DirRootExternal & "/tmp")
Maximo = fileliste.Size - 1
For i = 0 To fileliste.Size - 1
If i Mod Maximo = 0 Then
ProgressBar1.Progress = i/Maximo*100
DoEvents
End If
Next
activity.Finish
End Sub
Maximo = fileliste.Size - 1
For i = 0 To fileliste.Size - 1
If i Mod Maximo = 0 Then
It's normal, i Mod Maximo will never be 0 in the loop!
Add a Log(( i Mod Maximo)) in you code, just before the If statement, to show its value.
You should use:
B4X:
For i = 0 To Maximo
ProgressBar1.Progress = i/Maximo*100
DoEvents
Next