Eld*_*ran 1 delphi android asynchronous messagedialog
我在使用 FMX.Platform.IFMXDialogServiceAsync 时遇到问题
这是我的程序:
procedure TFormMain.btnLogoutClick(Sender: TObject);
var
ASyncService : IFMXDialogServiceASync;
begin
ASyncService.MessageDialogAsync('Do you want to logout?', TMsgDlgType.mtInformation,
[System.UITypes.TMsgDlgBtn.mbYes, System.UITypes.TMsgDlgBtn.mbNo],
TMsgDlgBtn.mbNo,
0,
procedure(const AResult: TModalResult)
begin
case AResult of
mrYes:
begin
Close;
end;
mrNo:
begin
// pressed no
end;
end;
end
);
end;
Run Code Online (Sandbox Code Playgroud)
以下是弹出窗口的错误:
Access violation at address
A29FC4F2, accessing address
00000000.
Run Code Online (Sandbox Code Playgroud)
直接尝试进入 Android 设备并在此过程触发时显示错误。查看 Embarcadero 文档,但他们没有为此提供示例。
有人写了一些我在上面使用的例子 http://c2design5sh.blogspot.co.id/2016/05/rad-studio-dx-101-berlin-dialog-api.html
有没有人能告诉我如何在 Android 中使用新的 MessageDialog 方式?,因为我发现 MessageDlg 已被弃用。
您只需要使用链接到的文章中的代码即可。你没有这样做。示例代码具有以下形式:
var
ASyncService : IFMXDialogServiceASync;
....
if TPlatformServices.Current.SupportsPlatformService(IFMXDialogServiceAsync, IInterface (ASyncService)) then
begin
ASyncService.MessageDialogAsync(....);
end;
Run Code Online (Sandbox Code Playgroud)
您的代码无法分配给ASyncService变量。因此出现运行时错误。
| 归档时间: |
|
| 查看次数: |
2149 次 |
| 最近记录: |