RadaeePDF.com :: Topic: BM Database, last added bookmark is not saved (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: BM Database, last added bookmark is not saved

BM Database, last added bookmark is not saved 3 years 1 week ago #6702

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.
The administrator has disabled public write access.

BM Database, last added bookmark is not saved 3 years 1 week ago #6704

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
BMDatabase.Close() shall flush data to storage.
The administrator has disabled public write access.
The following user(s) said Thank You: limmie
Powered by Kunena Forum