Why is the Android app coming out suddenly?

I use Delphi 10.2 to create an Android application that uses Rest components to read the returned data from a mail form. When I press a button to load data, they load it, usually after 3 seconds of freezing. The problem is if the user tries to click (or touch) any control in the application exit form immediately after freezing for 3 seconds, but if the user does not touch the application, the data was loaded normally!

What is the reason for this and how to fix it?

The code I use for the button is

RESTRequest1.Execute;

I use 3 components of RESTClient, RESTRequest and RESTResponse

and here is the code I use to get the data:

procedure TfrmMain.RESTRequest1AfterExecute(Sender: TCustomRESTRequest);
var
return_response: string;
begin
  if RESTResponse1.StatusCode = 200 then begin
    //fill years
    return_response := RESTResponse1.Content;

    memo1.text := return_response;

  end;

end.
+4
source share
1

ExecuteAsync, , . Execute , , . Android , (= freezed) , !

, doc:

ExecuteAsync . iOS (, , Android) , , , .. ,

.


ExecuteAsync, , , . , ExecuteAsync . :

RESTRequest1.ExecuteAsync(
 procedure
 begin
  ShowMessage('Finished!');
 end;);

, , alrady. , , , , ASynchronized: Boolean = True;, proc True .

+8

Source: https://habr.com/ru/post/1686658/


All Articles