If 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.
7 Comments