How to save annotations to a database

I have a strange requirement. The application will run on Android, one
of my pdf files will be inside of the Assets or Raw folder. I need to
open the pdf file add annotations and save them. I was told that the
Assets or Raw folder is read-only, so I won't be able to save the pdf
with the modifications.

I thought about saving the annotations information to a database, and
them when opening the pdf I read the informations from the database
and add the annotations back to the pdf. Is this possible?

This one pdf has to go with the instalation file (.apk) and can't be
saved to the sdcard.

Is there a better solution for that?

Hi Leonardo,

I think you are right that a raw resource file cannot be modified. As you described, it is possible to store the annotation information somewhere and add it to the PDF file every time it is loaded. However, this is not efficient.

I think a better way is to save the modified PDF to the directory associated with your APK, which can be retrieved from the main activity (e.g., your_activity.getCacheDir().getPath()). This way, you can load the modified PDF file from that directory instead of from the raw resource file.

Best Wishes,