Android Question Progressdialog Blink

PumaCyan

Member
Licensed User
how to solve progressdialog flashing while looping data?
 

Attachments

  • ezgif-4-769b403d97.gif
    ezgif-4-769b403d97.gif
    159.9 KB · Views: 109

PumaCyan

Member
Licensed User
sorry I forgot to attach my code...

B4X:
 Send_data (DB As String)
    For i = 0 To CLV1.Size - 1
            Dim cd As UserData = CLV1.GetValue(i)
            Dim req As DBRequestManager = CreateRequest(DB)
            Dim dbcmd As DBCommand = CreateCommand("insert_data", Array(params))
            '
            Dim j As HttpJob = req.ExecuteBatch(Array(dbcmd), Null)
            Wait For(j) JobDone(j As HttpJob)
            '
            PD.MyProgressDialogShow("Proses", "Process send to.." & i) '-- PD is custom progress with b4xdialog'
        Next
        '
        If j.Success Then
            PD.MyProgressDialogHide
            xui.MsgboxAsync("The message has been sent to : " & CLV1.Size & " users", "Succeed")
            Wait For Msgbox_Result (Result As Int)
            If Result = DialogResponse.POSITIVE Then
                B4XPages.ShowPageAndRemovePreviousPages("page1")
            End If
        Else
            TM.MyToastMsg("failed to send data")
            Return
        End If
        j.Release
End Sub
 
Upvote 0

teddybear

Well-Known Member
Licensed User
The sub Send_data looks a little weird, the Dialogshow is put inside of the forloop body, I don't know how you customize the PD.MyProgressDialogShow, it seems to be that each looping you will create a panel for dialogshow , so it blinks.
 
Last edited:
Upvote 0

PumaCyan

Member
Licensed User
The sub Send_data looks a little weird, the Dialogshow is put inside of the forloop body, I don't know how you customize the PD.MyProgressDialogShow, it seems to be that each looping you will create a panel for dialogshow , so it blinks.

i have tried to replace my progressdialog code with
B4X:
ProgressDialogShow2("Process send to.." & i, False)
but the results are exactly the same
 
Upvote 0

teddybear

Well-Known Member
Licensed User
i have tried to replace my progressdialog code with
B4X:
ProgressDialogShow2("Process send to.." & i, False)
but the results are exactly the same
There is no different from previous one.
You should put the PD.MyProgressDialogShow("Proses", "") outside of the forloop and define the lblText which is you would like to show"Process send to.." in MyProgressDialogShow as global.
In forloop replace PD.MyProgressDialogShow("Proses", "Process send to.." & i) with lblText.text="Process send to.." & i".

Just create panel once and then update its label text in for loop
 
Upvote 0
Top