Normally without having to code the android back button functions and lets you got back to the previous form. In my app i'm working on instead of going back it shuts down the application. I also tried handling the back button by code but this also didn't work, it ignored the code!
Here is the code I used to handle the backbutton:
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
var KeyChar: Char; Shift: TShiftState);
var
FService: IFMXVirtualKeyboardService;
begin
if Key = vkHardwareBack then
begin
TPlatformServices.Current.SupportsPlatformService
(IFMXVirtualKeyboardService, IInterface(FService));
if (FService <> nil) and (TVirtualKeyboardState.Visible
in FService.VirtualKeyBoardState) then
begin
// Back button pressed, keyboard visible, so do nothing...
end
else
begin
// Back button pressed, keyboard not visible or not supported on this platform
close;
end;
end;
end;
I used to use Delphi XE5 and now I use XE6 and hoped the problem was solved but regrettingly not. Also the above code is for the Delphi XE6 version, for XE5 it is slightly different.
UPDATE:
I've found a fix for my problem. But my delphi still reacts really strange. When I create a new project and add the files from my previous project i'm able to go back with the android backbutton. But as soon as I save the project again and then try to run it then it stops working.
After creating a new project in a new directory and then adding all the files too the project the issue had dissapeared! The problem seemed to be somewhere in de dproj file. I tried too find it, but it was to big for me to locate it.