• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to view pdf inside fragment

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to show several pdf files when i swipe in my viewpager application




this is my main activity



its working fine.how to show several pdf files when i swipe the screen?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By having the fragment implement a View that can display PDFs instead of just having a TextView.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is my fragment class which calls the pdf render app.But it shows the pdf above the current fragment.I need to show the pdf withing the fragment .how to archive this ?

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand what starting an intent/activity to view a PDF in another app has to do with fragments showing PDFs in your own app. Please clarify.

Obviously you need a View that can display PDFs, which is something you have asked about before. Have you found such a View? If not, this isn't going to work.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have separate app which display the pdf files.So i calling that app to view the pdf files.It view the pdf files ,but it is not in the fagment.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the display happens in a separate app then what is the purpose of the fragments in your app (which will not be displaying anything)? Either the View is part of your app, or it's part of some other app - not both.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
earlier i viewed pdf using pdfviewer.jar.below is the code for that




now i need to call above code in my fragment.but its unable to call activity from fragment.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "call" mean? How is "it" unable to do that? What is "it"? You should constantly remind yourself that we do not know what happens in your code, nor, actually, what you are now attempting to do.

If you're still somehow under the impression that you can get some other app to display something as part of your app, then I have already pointed out that that is simply not possible. Any further attempts in this direction are a waste of time.

If you want to adapt your code that uses an intent to start another app to somehow work differently, then you need to tell us in detail how you want it to work differently.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my app to view pdf file uusing pdfviewerr.jar file







This app works fine app.Now i need to show pdf on my fragments.My new app has 3 fragments.i need to call separate pdf file on each fragment.below is my fragment






.....
i didn't copy other two fragments.those are same as above.only name changes

I need to know how to view pdf files on fragment?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't anything else I can contribute but saying once more (for the last time): you need a View that can display PDFs. If you have that, it makes sense to proceed, but otherwise it's futile.

"PdfViewerActivity" sounds promising in that regard. I suggest you dig into the documentation and source code of that library to see what it does to display PDFs. Maybe you're able to extract code for a PDF View from it. Keep in mind that code is licensed under the LGPL, which has implications on how you need to license your app if you decide to distribute it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic