Android Question Opening up a PDF

Mr Sparkle

New Member
Licensed User
Longtime User
Can someone please help me. I have tried different variations on the code and can't seem to get it to work. I am trying to send a locally saved PDF document to an installed reader (polaris and/or adobe) on my device. Each time it says "an error occurred while opening the document".

B4X:
Dim FileName As String = "1.pdf"
       
Msgbox ( File.Exists (File.DirInternal, FileName),"")
       
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, "file://" & File.Combine(File.DirInternal , FileName))
Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
Intent1.SetType("application/pdf")
Intent1.WrapAsIntentChooser ("Choose Viewer")
StartActivity(Intent1)

The msgbox gives a result of TRUE so I know the file exists as well the PDF file is not corrupted.

Any help would be greatly appreciated.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…