Android Question Doubts on Imageview/LoadBitmap

Discussion in 'Android Questions' started by FERNANDO SILVEIRA, Apr 26, 2018.

  1. FERNANDO SILVEIRA

    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: Apr 26, 2018
  2. BillMeyer

    BillMeyer Active Member Licensed 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 !!
     
    Claudio Oliveira likes this.
  3. FERNANDO SILVEIRA

    FERNANDO SILVEIRA Active Member Licensed User

    Thank you BillMeyer (and @Cableguy as well)
    You brought very interesting points here. I'll read it through. I liked the concept of keeping things appart from the app and use an external storage makes all sence.
     
    Claudio Oliveira likes this.
  4. KMatle

    KMatle Expert Licensed User

    You can add/remove views at runtime as you like. So just do what you need/want.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice