What is the best way to store the image in the memory of app?

后端 未结 4 1073
再見小時候
再見小時候 2021-01-16 07:38

I\'m using sqlite db in my app and now I would like to allow user customize the background image make them able to select one from their gallery.

Should I just store

相关标签:
4条回答
  • 2021-01-16 07:44

    I think it would be better to save only the path of the background, you won't be limited by the size of the image

    0 讨论(0)
  • 2021-01-16 07:54

    You wouldn't store it as text. Store it as blob to your database. In my opinion this is the way to go (if you use SQLite anyway).

    If you have large images then store the path to your storage and not the image to the database.

    0 讨论(0)
  • 2021-01-16 07:56

    In my opinion, the best way to save the customized background image is copy it into the internal storage (private storage) of your application. If you store only the path of the file, then file cannot be available once the user deleted that. The official docs saying about the internal storage is:

    • It's always available.
    • Files saved here are accessible by only your app by default.
    • When the user uninstalls your app, the system removes all your app's files from internal storage.
    0 讨论(0)
  • 2021-01-16 07:58

    SQLite has a cursor limit of 1Mb. So, you will probably not be able to store it completely in the DB, when you go to to request it will probably be truncated. Store the path to the image in the database table, and access it that way.

    0 讨论(0)
提交回复
热议问题