M mw71 Well-Known Member Licensed User Longtime User Sep 13, 2025 #1 Hi I have a B4A Activity app. I want to let the user select a folder where I can then write a file (SQLite). I'm not sure whether SAF (https://www.b4x.com/android/forum/threads/externalstorage-access-sd-cards-and-usb-sticks.90238/) or SaveAs (https://www.b4x.com/android/forum/t...list-of-other-related-methods.129897/#content) is the right way to do this.
Hi I have a B4A Activity app. I want to let the user select a folder where I can then write a file (SQLite). I'm not sure whether SAF (https://www.b4x.com/android/forum/threads/externalstorage-access-sd-cards-and-usb-sticks.90238/) or SaveAs (https://www.b4x.com/android/forum/t...list-of-other-related-methods.129897/#content) is the right way to do this.
Erel B4X founder Staff member Licensed User Longtime User Sep 14, 2025 #2 SaveAs (ContentChooser) - Lets the user pick a destination for the currently resource that is being saved. ExternalStorage - A mechanism for the user to grant access to your app to a specific folder. Sounds like you need ExternalStorage. Notes about SQLite: 1. Use XUI.DefaultFolder for the database and copy it when needed. You cannot open a db with ExternalStorage or SaveAs. 2. Set the journal mode to DELETE: https://www.b4x.com/android/forum/threads/b4x-sql-setting-the-journal-mode.136211/#content Upvote 0
SaveAs (ContentChooser) - Lets the user pick a destination for the currently resource that is being saved. ExternalStorage - A mechanism for the user to grant access to your app to a specific folder. Sounds like you need ExternalStorage. Notes about SQLite: 1. Use XUI.DefaultFolder for the database and copy it when needed. You cannot open a db with ExternalStorage or SaveAs. 2. Set the journal mode to DELETE: https://www.b4x.com/android/forum/threads/b4x-sql-setting-the-journal-mode.136211/#content
M mw71 Well-Known Member Licensed User Longtime User Sep 15, 2025 #3 Thanks for your reply, Erel. I should have specified "write a file (SQLite)" more precisely. I use File.DirInternal to write to and use the file. Then, I would like to copy the file for backup and sharing purposes. I will also take a look at ExternalStorage. Thanks also for the tip about Journal Mode. Upvote 0
Thanks for your reply, Erel. I should have specified "write a file (SQLite)" more precisely. I use File.DirInternal to write to and use the file. Then, I would like to copy the file for backup and sharing purposes. I will also take a look at ExternalStorage. Thanks also for the tip about Journal Mode.
Erel B4X founder Staff member Licensed User Longtime User Sep 16, 2025 #4 mw71 said: Then, I would like to copy the file for backup and sharing purposes. Click to expand... Sounds like a good use case for SaveAs. Let the user decide where the file is backed up. Maybe to their Google Drive for example. Upvote 0
mw71 said: Then, I would like to copy the file for backup and sharing purposes. Click to expand... Sounds like a good use case for SaveAs. Let the user decide where the file is backed up. Maybe to their Google Drive for example.