Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this library with Fragment #36

Open
csharsha opened this issue Nov 16, 2014 · 5 comments
Open

How to use this library with Fragment #36

csharsha opened this issue Nov 16, 2014 · 5 comments

Comments

@csharsha
Copy link

Hi,
How can I use this library with Fragment. I have gone through the source code, current code only supports only Activity. Please help me to achieve the same with Fragment.

Thanks

@supareek
Copy link

Did you find a solution to this?

@csharsha
Copy link
Author

I just tried to modify the source code for fragment, but pdf content is not displayed instead a black screen is displayed in fragment area.

@destrike
Copy link

Anyone solved this problem?

@Kshitiz1208
Copy link

Since "this" doesnt work in a fragment we have to use "getActivity()" instead.
Similarly "getFilesDir()" has to be preceded with "getActivity()".
I got my code working through this.

Here is the code to use with fragment -

Intent intent = new Intent(getActivity(), PdfViewer.class); intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, getActivity().getFilesDir() + "/chapter.pdf"); startActivity(intent);

@lhoracek
Copy link

lhoracek commented Nov 9, 2016

I'm using this inside fragment without any problems. using PDFView in my fragments layout and then calling the load from assets as described in sample in my onViewCreated method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants