question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalStateException: Don't call load on a PDF View without recycling it first

See original GitHub issue

I have a tab view wherein three tabs exists. All the tab has pdfview. Each tab loads different pdf file from the database. Whenever the downloaded file loads in the pdfview (all this is happening inside async task) the following error shows up and then the app crashes

java.lang.IllegalStateException: Don't call load on a PDF View without recycling it first

I am not sure what am I supposed to do!

class MyAsync extends AsyncTask<Void, Void, Void> {

            
           PDFView pdfView;
            

            public MyAsync(PDFView pdfView) {
                
               this.pdfView = pdfView;
                

            }

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                pd.setMessage("Uploading . . .");
                pd.show();
                pd.setCancelable(false);
            }

            @Override
            protected Void doInBackground(Void... voids) {

               publishProgress();

                return null;
            }

            @Override
            protected void onProgressUpdate(Void... values) {

               


                dataRef.child(dbs).addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        if (dataSnapshot.hasChild(root_child)) {
                            String url = dataSnapshot.child(root_child).getValue().toString();
                            StorageReference island = storage.getReferenceFromUrl(url);

                            final File file;

                            try {
                                file = File.createTempFile(file_name, "pdf");
                                island.getFile(file).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
                                    @Override
                                    public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {

                                        yes_file(pdfView, tv1, tv2);
                                        pdfView.fromFile(file).load();
                                        
                                    }
                                }).addOnFailureListener(new OnFailureListener() {
                                    @Override
                                    public void onFailure(@NonNull Exception e) {
                                        Toast.makeText(getActivity(), "Upload unsuccessful", Toast.LENGTH_LONG).show();
                                    }
                                });
                            } catch (IOException e) {
                                e.printStackTrace();
                            }


                        } 
                    }

                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }
                });
            }

            @Override
            protected void onPostExecute(Void aVoid) {
                super.onPostExecute(aVoid);
                pd.dismiss();
            }
        }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
barteksccommented, Jan 6, 2018

Issue should be fixed in 3.0.0-beta.5 version

2reactions
gustavohansencommented, Jan 11, 2018

@barteksc when are you planing to release 3.0.0-beta.5 version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not open pdf document in my application - Stack Overflow
I am using this library. I am trying to load a PDF located in assets & it does not load.
Read more >
java.lang.IllegalStateException: Don't call load on a PDF View ...
I have a tab view wherein three tabs exists. All the tab has pdfview. Each tab loads different pdf file from the database....
Read more >
com.github.barteksc.pdfviewer.listener.OnErrorListener
OnErrorListener Java Examples ... userPages) { if (!recycled) { throw new IllegalStateException("Don't call load on a PDF View without recycling it first.
Read more >
com.lidong.pdf.DecodingAsyncTask.<init> java code examples ...
Best Java code snippets using com.lidong.pdf. ... (!recycled) { throw new IllegalStateException("Don't call load on a PDF View without recycling it first.
Read more >
com.joanzapata.pdfview.PDFView Maven / Gradle / Ivy
(!recycled) { throw new IllegalStateException("Don't call load on a PDF View without recycling it first."); } // Manage UserPages if not null if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found