Android Question How to open .PDF file by specific intent?

RomansUP

Member
Licensed User
Longtime User
Well thanks. But I think You did not understand me correctly.

look, this code
dim i as intent
i.Initialize(i.ACTION_VIEW, "file://" & File.DirDefaultExternal & "/test.pdf")
i.SetType("application/pdf")

StartActivity(i)
must open application what was set as default for .pdf extension or open chooser with list of applications which can open .pdf After what application will launch and test.pdf will be open automatically inside application.
But I am looking for the code where I can programmably launch the application that I will decide to open the test.pdf. Test.pdf file must also open automatically inside this application. And No chooser must opening.
Thanks
 
Upvote 0

RomansUP

Member
Licensed User
Longtime User
Yes I want to open .pdf or any other extension with external application what was installed on my android device. But I want to choose this application programmably, without opening android chooser. What I will do :
First - I get intent one of installed application what can open .pdf . I know already how to do this.
Second - What I am looking for _ How to run this application by using StartActivity(i) where i is intent of this external application with desired PDF file simultaneously.??? PDF file must open inside external application automatically!
Thanks
 
Upvote 0

RomansUP

Member
Licensed User
Longtime User
Sorry
But there is no PackageManager.QueryActivityIntent in phone library ver 2.40
just PackageManager.QueryIntentActivities
 
Upvote 0

RomansUP

Member
Licensed User
Longtime User
Well I got it and done it!
I used PackageManager.QueryIntentActivities() and intent.SetComponent()

Thank you very much Erel. You saved me.
 
Upvote 0
Top