Open A PDF on Adobe Reader

cncncn

Member
Licensed User
Longtime User
Hi!
I would like to open a PDF on Adobe Reader but everytime Adobe opens, there is this message: 'Can not open open file'
I checked directory file, filename and I can open the file directly by Adobe.
I don't see a mistake in my code
B4X:
Dim PdfIntent As Intent      

PdfIntent.Initialize(PdfIntent.ACTION_VIEW,File.Combine(DestDT,DT))      PdfIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
 PdfIntent.SetType("application/pdf")
StartActivity(PdfIntent)
I really need some :sign0085:

Thanks in advance
 

GMan

Well-Known Member
Licensed User
Longtime User
i would like to know that, too :sign0163:
 
Upvote 0

cncncn

Member
Licensed User
Longtime User
My mistake was in my uri when I intialize the intent.

I wrote "/storage/sdcard0/.../file.pdf"
and the right way was "file:///storage/sdcard0/.../file.pdf"

I hope it can help you
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
thx, found already this solution:

B4X:
Sub OpenPDF(filename As String)
Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, filename)
i.SetType("application/pdf")
'i.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(i)
End Sub

B4X:
Dim folder   As String         
folder=File.DirRootExternal & "/nem" 
Dim filename As String 
   If Position = 0 Then
   filename = "nem001" & Country & ".pdf"
   OpenPDF("file://" & File.Combine(folder, filename))

Without
B4X:
i.WrapAsIntentChooser("Choose PDF Viewer")
the choosing-popup doesnt appear each time
 
Upvote 0
Top