Android Question Error open pdf

devmobile

Active Member
Licensed User
Hello
I cannot open pdf file and get below error (i have a pdf reader in my device)

My code :
B4X:
    Dim it As Intent
    it.Initialize(it.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal & "/", "invoice.pdf"))
    it.SetType("application/pdf")
    StartActivity(it)
 

Attachments

  • photo_2017-06-27_01-46-01.jpg
    photo_2017-06-27_01-46-01.jpg
    21.2 KB · Views: 665

Star-Dust

Expert
Licensed User
Longtime User
Try this
B4X:
Dim it As Intent
it.Initialize(it.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal , "invoice.pdf"))
it.SetType("application/pdf")
StartActivity(it)
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
B4X:
Dim it As Intent

it.Initialize(it.ACTION_VIEW, File.Combine(File.DirRootExternal , "invoice.pdf"))
it.SetType("application/pdf")
StartActivity(it)

Not need "file://"
 
Upvote 0

devmobile

Active Member
Licensed User
B4X:
Dim it As Intent

it.Initialize(it.ACTION_VIEW, File.Combine(File.DirRootExternal , "invoice.pdf"))
it.SetType("application/pdf")
StartActivity(it)

Not need "file://"
It get error
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=/storage/emulated/0/invoice.pdf typ=application/pdf flg=0x20000 }
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Have installed PDF reader?
 
Upvote 0
Top