i am trying to create a login form to my main android form, so i do something like this
var
CanGo: Boolean;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
loginfrm := Tloginfrm.Create(nil);
try
loginfrm.ShowModal;
CanGo := loginfrm.LoginSuccess = true;
finally
FreeAndNil(loginfrm);
end;
if CanGo then
Application.Run;
end.
i been doing this in win32 application and its working just fine , when i try to do the same way on android application stopped on touchscreen and wont show login form , is Show modal is different on android ? what iam doing wrong ?
There are lots of similar questions here on SO. Read the documentation:
FMX.Forms.TCommonCustomForm.ShowModal
Caution: Modal dialog boxes are not supported in Android apps. Instead of calling ShowModal, you should call Show, and have the form return and call your event. We recommend do not use modal dialog boxes on either of the mobile platforms (iOS and Android) because unexpected behavior can result. Avoiding usage of modal dialog boxes eliminates potential problems in debugging and supporting your mobile apps.
There have been different ways to call ShowModal
proposed by Embarcadero since the mobile platforms were introduced. All of them had flaws, and now docs tells you not to use them at all.