Android Question Doubts on Imageview/LoadBitmap

FERNANDO SILVEIRA

Active Member
Licensed User
Hello Guys,

I'm using Imageview/LoadBitmap/LoadBitmapResize to present .JPG files based on program logic.

My question is: Do I have to load every single .JPG file to the project at design time? What If I just add new .JPG to file directory? Will my app find these new files or do I have to manually add them + recompile the app each time a new image is added?

The same question is valid for files: I added at design time a text file that I load at the beggining of my app. If I edit/modify this file with notepad later, for instance after the app is done. Do I have to remove the old file/add updated one/recompile my app or edit file is enough for the app run with the new file content?

Regards,
Fernando
 
Last edited:

BillMeyer

Well-Known Member
Licensed User
Longtime User
Hi Fernando,

My take on your question, if I understand it correctly, is that you want to create the app, compile it with a certain number of files in the assets and then publish it. Thereafter you wish to add to these files WITHOUT going through the whole process of add, recompile, publish.

In this instance, I would make use of a backend server where I could save my files (the new ones - even all of them) and then when I open my app (as a user) the app would check if the files exist locally (on the device) and if not - then download them to the device. In this manner (checking for existence) you do not download every file every time.

There are several ways in which you can go about this:

1. You can use Firebase Storage and here you should use the /public folder. Tutorial Here: https://www.b4x.com/android/forum/threads/firebasestorage-simple-file-storage-backend.68350/

2. You could use a Web Server on which you create a folder to place all your documents and images that you wish to distribute. Then create a small database (they come with most Web Servers now a days) with your documents listed. When you open the app, check this database, compare to the files listed locally and then download only those you don't have on the device. Code Snippet Here: https://www.b4x.com/android/forum/threads/b4x-one-liner-downloads.81763/ and here is another one: https://www.b4x.com/android/forum/threads/imagedownloader-the-simple-way-to-download-images.30875/

3. You could use a MySQL database to store the images and documents in, but this is only to be used as a last resort, as it is cumbersome and the size of your database will grow dramatically. This method would involve using Blob's, Base64 encoding and decoding or if you have a jRDC2 Server, BytesToImage/ImageToBytes and more information is here: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167

I hope that this give you some additional insight.

Enjoy !!
 
Upvote 0
Top