Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC:

Set cache fails and succeeds randomly 9 years 10 months ago #6415

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 1
I am trying to save a bitmap to a pdf page. SetCache is failing but sometimes succeeds. Is there a specific order I need to call setCache? What is setcache calling to make sure it succeeds?

Please Log in or Create an account to join the conversation.

Set cache fails and succeeds randomly 9 years 10 months ago #6416

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 1
Global was messing with the cache, it works.

thanks

Please Log in or Create an account to join the conversation.

Set cache fails and succeeds randomly 9 years 10 months ago #6418

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 1
I thought i fixed it, but the problem is still happening. Setcache returns false and I cannot save a bitmap annotation. Adding the annotation with addbitmapannotation returns true, but the annotation count is 0.

Please Log in or Create an account to join the conversation.

Last edit: by jstampe.

Set cache fails and succeeds randomly 9 years 10 months ago #6419

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
do not share 1 file as cache file to 2 document objects.
it is important. and invoke Document.close() to release cache file.

Please Log in or Create an account to join the conversation.

Set cache fails and succeeds randomly 9 years 10 months ago #6422

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 1
I do not share files. I open multiple documents in a view pager. The only sharing is Global. Each has its own PDFReader and Document, but i have found that sometimes calling setcache would fail, but if i closed and reopened the app, setcache would succeed. I always invoke document.close when the view pager destroys the fragment the pdfreader is in.

I am using

mDocument.SetCache(Global.tmp_path + "/" + String.valueOf(mPageNumber) + "/temp.dat");

Please Log in or Create an account to join the conversation.

Set cache fails and succeeds randomly 9 years 10 months ago #6423

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 1
This is working mDocument.SetCache(Global.tmp_path + "/" + String.valueOf(mPageNumber) + "temp.dat");

Im assuming setcache does not create directories, though maybe it should.
The following user(s) said Thank You: clavarreda

Please Log in or Create an account to join the conversation.

Last edit: by jstampe.
  • Page:
  • 1
  • 2
Powered by Kunena Forum