java.lang.IllegalStateException: Don't call load on a PDF View without recycling it first
See original GitHub issueI 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:
- Created 6 years ago
- Comments:24 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Issue should be fixed in 3.0.0-beta.5 version
@barteksc when are you planing to release 3.0.0-beta.5 version?