Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Handle Hardware Back Button In Delphi XE5 Firemonkey On Android

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Handle Back Button Delphi Android | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSIf you are looking for how to handle the hardware back button in your Delphi Android application then I think I have found the best answer to it on Stackoverflow. There are quite a few answers to the question multiple times but I think this one handles it the best. In addition to handling the back button it also takes the virtual keyboard into account and also handles a back button press when the virtual keyboard is visible. Here is a short snippet on how to just handle the back button but you’ll need to view the full answer to get the virtual keyboard part of it.
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
begin
if Key = vkHardwareBack then
begin
// handle it
Key := 0;
end;
end;

Click over and get the full code snippet for Android.

Exit mobile version