Manitikyl
Manitikyl

Reputation: 115

FireMonkey: 2 Form

I had a question. I created 2 forms, first appears at the beginning, but after a while I need to finally destroy it and switch to the second, switching works, but if you press the back button (on the phone), a black screen appears, because it goes to the first form that I destroy, poidee and must close the application. How to implement it correctly.

Upvotes: 0

Views: 204

Answers (1)

SimaWB
SimaWB

Reputation: 9294

Use OnKeyUp event of the second form to detect pressing the back button:

if Key = vkHardwareBack then
begin
  // if you want, close the app.
  Key := 0;
end

if you want to close the app:

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

Upvotes: 3

Related Questions