Android Question ExecuteRemoteQuery

bashka_abdyli

Member
Licensed User
Longtime User
Hello,

I am using ExecuteRemoteQuery to insert some data in a MySQL Database.

I have a button when users clicks it there are three statements run:

sub Button_Clicked

button.enabled = false

ExecuteRemoteQuery(query1) --duration approx 7 sec
ExecuteRemoteQuery(query2) --duration approx 3 sec
ExecuteRemoteQuery(query3) --duration approx 11 sec

button.enabled = true

end sub

At the beginning of the query I make the button disabled in order to prevent that users clicks it again. But the button becomes enabled even if the queries before the queries are completed.

How to prevent this?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The network requests are asynchronous requests. You can add a process_global variable named queriesCounter:
B4X:
sub Button_Clicked

button.enabled = false
queriesCounter = 3
ExecuteRemoteQuery(query1) --duration approx 7 sec
ExecuteRemoteQuery(query2) --duration approx 3 sec
ExecuteRemoteQuery(query3) --duration approx 11 sec

end sub

Sub JobDone (Job As HttpJob)
  queriesCounter = queriesCounter - 1
 If queriesCounter <= 0 Then button.Enabled = True
 ...
 
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
Hello,
clicking on command, I have to run some queries in sequence, but doing one only after the previous one
has completed its action, how can I do?

Thanks
 
Upvote 0
Top