Android Question Error open pdf

svitol

Member
Hi i need to open pdf after creation, but have an error on File Provider
The pdf is created but i don't know how i can show it ...
this is my code:
B4X:
...
...
Dim pdf As PdfDocument
    pdf.Initialize
    pdf=fg.crea_pdf(pdf,app_cfg.entity_id,tipologia)    
    Dim s As String ="Ordine_" & app_cfg.numero_ordine
    Dim FileName As String = s.Replace(" ","_") & ".pdf"
Dim out As OutputStream = File.OpenOutput(Starter.shared, FileName, False)
    
    pdf.WriteToStream(out)
    out.Close
    pdf.Close
    
    
    displayPDF(FileName)
    ..
    ...
    
    ...
    
    
    Sub displayPDF(FileName As String)
    
    
    Dim in As Intent
    in.Initialize(in.ACTION_VIEW, "")
    Starter.Provider.SetFileUriAsIntentData(in, FileName)
    'Type must be set after calling SetFileUriAsIntentData
    in.SetComponent("android/com.android.internal.app.ResolverActivity")
    in.SetType("application/pdf")
    StartActivity(in)
    
End Sub
 
Top