BM Database, last added bookmark is not saved - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: BM Database, last added bookmark is not saved

BM Database, last added bookmark is not saved 3 years 8 months ago #6702

  • developer24
  • developer24's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0
Hello everybody,
I used BmDatabase class to let the user add bookmarks to pdf files. The bookmarks are saved in a sqlite file placed in the application's internal directory. I also show the added bookmarks in a list while the pdf file is opened. Everything works well except for one thing: when the user closes and opens the same pdf again, the last bookmark that was saved is not shown anymore. So for example, if the user adds just one bookmark the first time they open the pdf file, none is shown after the same pdf is re-opened; if they add two bookmarks, only the first one is shown after the same pdf is re-opened. Could you please tell me what I am doing wrong?

This is the code I'm using to save a bookmark:

int recordAdd = bmDatabase.RecOpen(bookmarkDbFilePath);
int pageAdd = m_reader.GetCurrentPageNumber();
String bookmarkName = "Page " + (pageAdd + 1);
boolean success = bmDatabase.RecItemInsert(recordAdd, bookmarkName, pageAdd);

bmDatabase.RecClose(recordAdd);

if (success) {
// Refresh the bookmark list: this works fine, success is true every time and the list is always refreshed
// ...
}

This is the code I'm using to read the saved bookmarks when I open the pdf file:

bookmarkDbFilePath = getFilesDir() + File.separator + fileName; // fileName includes .sqlite extension

int records = bmDatabase.RecOpen(bookmarkDbFilePath);
int count = bmDatabase.RecGetCount(records);
for (int i = 0; i < count; i++) {
String name = bmDatabase.RecItemGetName(records, i);
int pageno = bmDatabase.RecItemGetPage(records, i);

ActionItem item = new ActionItem(i, name, pageno, null);
quickAction.addActionItem(item);
}

bmDatabase.RecClose(records);


N.B.: "count" here is one less than it should be (i.e. if the user previously added 4 bookmarks, count is 3).

Last but not least, I am confused about the type of license I need to make the bookmarks work. Is the Standard license enough?

Thanks in advance for your help.

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

BM Database, last added bookmark is not saved 3 years 8 months ago #6704

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
BMDatabase.Close() shall flush data to storage.
The following user(s) said Thank You: limmie

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

  • Page:
  • 1
Powered by Kunena Forum