A
A
Alexander Vishnev2019-02-27 16:06:51
Android
Alexander Vishnev, 2019-02-27 16:06:51

How in the Delphi development environment to make an Android application on pressing the BACK button on your device go to the previous page?

There is a webview application project created in Delphi RAD Studio.
I can not figure out how to make the transition to the previous page by pressing the "Back" button on the device.
In the form I registered the interception of the key, and everything would be fine, but when you click on the "Back" button, the transition is performed only once. If you press the button again, the application simply collapses. And even after closing the application and reopening, pressing the back button minimizes. Only a complete reinstallation of the application helps.
webapp - TWebBrowser component

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
  Shift: TShiftState);
begin
   if Key = vkHardwareBack then
begin
 webapp.GoBack;
end;
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kalapanga, 2019-02-27
@fromdns

I didn’t write under Android, but logically after webapp.GoBack; need Key := 0; make the button not be processed further.
But then you probably need to add some other condition, under which the button should work in the usual way and then it should not be reset.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question