Android Question upload image from memory to sqlite

Hello
Couldn't find a similar question on the forum on my own, sorry. Is there a way to upload a photo from my phone to SQLite?
So that the user can see the gallery and select a photo.
I will be glad for any help.
 

KMatle

Expert
Licensed User
Longtime User
My favourite way is to let the user select images and share it to my/your app: https://www.b4x.com/android/forum/threads/retrieve-one-or-multiple-image-s-shared-to-your-app.91612/

Next step: Convert the image to bytes and to a base64 string (strings are easier to handle and can be transfered between platforms) and store it to SQlite.

Better: Save the image to Dir.Internal (without converting it) and create an index in your SQLite db.

Of course it depends on what you are trying to achieve. With this solution no permissions are needed, others need permissions or it will get difficult with newer Android version (accessing folders outside your app).
 
Upvote 0
My favourite way is to let the user select images and share it to my/your app: https://www.b4x.com/android/forum/threads/retrieve-one-or-multiple-image-s-shared-to-your-app.91612/

Next step: Convert the image to bytes and to a base64 string (strings are easier to handle and can be transfered between platforms) and store it to SQlite.

Better: Save the image to Dir.Internal (without converting it) and create an index in your SQLite db.

Of course it depends on what you are trying to achieve. With this solution no permissions are needed, others need permissions or it will get difficult with newer Android version (accessing folders outside your app).
[/ЦИТИРОВАТЬ]
Thank you so much for your help!!!

1. Choose the image with ContentChooser.
2. Read the bytes with File.ReadBytes.
3. Add it to the SQLite database.

Thank you so much for your help!!!
 
Upvote 0
Top