百度网上代码,发现少一个引用:Androidapi.Helpers,StringToJString会报错,编译不通过!
uses Androidapi.Helpers, FMX.Helpers.Android, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net, Androidapi.JNI.JavaTypes, 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;
procedure TMainform.FormCreate(Sender: TObject); begin XOpenURL('http://192.168.1.199:8004/mes2.html'); end; procedure TMainform.XOpenURL(AUrl: String); var Intent: JIntent; begin Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW, TJnet_Uri.JavaClass.parse(StringToJString(AUrl))); SharedActivity.startActivity(Intent); end;