Delphi移动开发:打开一个网址

来源:互联网 发布:淘宝买家秀征集活动 编辑:程序博客网 时间:2024/06/06 09:16

IOS下

usesPosix.Stdlib;procedure TForm1.btnStartClick(Sender: TObject);begin  _system(PAnsiChar('open http://127.0.0.1:8001'));end;

uses  Apple.Utils;procedure TForm2.btnStartClick(Sender: TObject);begin  SharedApplication.openURL(StringToNSURL('http://www.embarcadero.com'));end;


Andorid下


uses  Androidapi.JNI.GraphicsContentViewText,  FMX.Helpers.Android;procedure TForm2.btnStartClick(Sender: TObject);var  intent: JIntent;begin  intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW,    TJnet_Uri.JavaClass.parse(StringToJString(TIdURI.URLEncode(URL))));  try    SharedActivity.startActivity(intent);    exit(true);  except    on e: Exception do    begin      if DisplayError then        ShowMessage('Error: ' + e.Message);      exit(False);    end;  end;end;

来自东子哥的Blog

海峡移动开发技术群:13734312
原创粉丝点击