1

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;

以下はポップアップするエラーです:

Access violation at address
A29FC4F2, accessing address
00000000.

この手順がトリガーされるたびに、Android デバイスとエラーを直接表示しようとしました。Embarcadero Documentation を参照しましたが、この例は提供されていません。

上記で使用する例を誰かが書いています http://c2design5sh.blogspot.co.id/2016/05/rad-studio-dx-101-berlin-dialog-api.html

AndroidでMessageDialogの新しい方法を実行する方法を教えてくれる人はいますか?

4

1 に答える 1

5

リンク先の記事のコードを使用するだけです。あなたはそうしませんでした。サンプル コードの形式は次のとおりです。

var
  ASyncService : IFMXDialogServiceASync;
....
if TPlatformServices.Current.SupportsPlatformService(IFMXDialogServiceAsync, IInterface (ASyncService)) then
begin
  ASyncService.MessageDialogAsync(....);
end;

あなたのコードはASyncService変数への代入に失敗します。したがって、実行時エラー。

于 2016-12-19T08:41:55.950 に答える