B4J Tutorial Open external documents

jFX.ShowExternalDocument method allows you to open external documents with the default installed app.

It expects a single parameter which is the document or resource Uri (link).

You can use File.GetUri to get the Uri of a local file.

For example to open a local PDF document:
B4X:
fx.ShowExternalDocument(File.GetUri("C:\Users\H\Documents", "Document.pdf"))

You can also use it with a non-local resource:
B4X:
fx.ShowExternalDocument("http://www.b4x.com")

Caveats:
-
This method doesn't throw any error if the resource cannot be opened.
- You cannot use this method with assets files (files added to the Files tab). It will only fail in Release mode when the files are packaged inside the jar.
You can use File.Copy to copy it from the assets folder and then open it.

This method was added in V1.00 beta 6.
 

DonManfred

Expert
Licensed User
Longtime User
Top