0
votes

With Delphi 11 I'm doing a Android app.

I have a main form (TMainForm) with a layout where I pop/push some views.

When user touch back button (vkHardwareBack) I cancel the key and manually pop view.

if Key = vkHardwareBack then begin
  Key := 0;
  Scenes.Pop;
end;

The problem, is when the stack scene contain only 1 view, the back button delete it and the user see the empty main form, when he do back again, the app go to background.

If I let Firemonkey do the back action

if (Key = vkHardwareBack) and (Scenes.Count > 1) then begin
  Key := 0;
  Scenes.Pop;
end;

I get the same result, Firemonkey pop the last scene and show the empty form.

Does it exist something to sent app to background manually ? like the code below ?

if Key = vkHardwareBack then begin
  Key := 0;
  if Scenes.Count > 1 then
    Scenes.Pop
  else 
    SendAppToBackground;
end;