Delphi移动开发打开一个网址
目录
Delphi移动开发:打开一个网址
IOS下
uses
Posix.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