Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Android home and back button from Delphi

I'm writing an app for an Android tablet in Delphi XE7. I want to turn off home and back button so no one can leave the application. I have found many answers, but none refers to Delphi.

How can I achieve this in Delphi? What objects should I use? Which units I need to include?

like image 392
Gpgerhard Avatar asked Dec 25 '22 00:12

Gpgerhard


1 Answers

From documentation

Using the Android Device's Back Button

To make your application handle when users press the Back button on their Android device, add an event handler to your form for OnKeyUp, and use the following code within your event handler: In Delphi:

if Key = vkHardwareBack then
begin
  // Do whatever you want to do here
  Key := 0; // Set Key = 0 if you want to prevent the default action
end;
like image 132
RBA Avatar answered Dec 28 '22 22:12

RBA