How do I open URLs, PDFs, etc. with the default apps?

后端 未结 2 1119
北恋
北恋 2021-02-14 08:56

I am developing an Android application with Delphi XE5, and I would like to know how I can open a URL in the default browser, and a PDF file with the default reader. Developing

2条回答
  •  忘掉有多难
    2021-02-14 09:37

    n00b here can't work out how to add a comment to the set of comments already posted against the previous answer, but I use this, which is another variation on the theme, using constructor parameters:

    procedure LaunchURL(const URL: string);
    var
      Intent: JIntent;
    begin
      Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW,
        TJnet_Uri.JavaClass.parse(StringToJString(URL)));
      SharedActivity.startActivity(Intent);
    end;
    

提交回复
热议问题