This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

how to view pdf inside fragment

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By having the fragment implement a View that can display PDFs instead of just having a TextView.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic