Search code examples
androiddelphifiremonkeyback-buttondelphi-xe5

Delphi XE5 Android. Hardware back button press


How simulate hardware back button press to close application?

I need close the application by code but Application.Terminate, Close, Hide and DisposeOf do not work.

So I thought to simulate hardware back button press to achieve my goal.


Solution

  • {$IFDEF ANDROID}
        MainActivity.finish;
    {$ENDIF}