unit MainForm;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation,
FMX.StdCtrls, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.App, Androidapi.Helpers,
Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.JNI.Os, Androidapi.JNI.Widget;
type
TForm1 = class(TForm)
ButtonShowDialog: TButton;
procedure ButtonShowDialogClick(Sender: TObject);
private
{ Private declarations }
procedure ShowDialog(const ATitle, AMessage: string);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.ButtonShowDialogClick(Sender: TObject);
begin
ShowDialog('标题', '这是一个对话框示例');
end;
procedure TForm1.ShowDialog(const ATitle, AMessage: string);
var
DialogBuilder: JAlertDialog_Builder;
begin
TThread.Queue(nil,
procedure
begin
DialogBuilder := TJAlertDialog_Builder.JavaClass.init(TAndroidHelper.Context);
DialogBuilder.setTitle(StrToJCharSequence(ATitle));
DialogBuilder.setMessage(StrToJCharSequence(AMessage));
DialogBuilder.setPositiveButton(StrToJCharSequence('确定'), nil);
DialogBuilder.create.show;
end);
end;
end.
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.11722993850708 seconds