B4J Question What is the best way to keep variables available in each form in b4j

Discussion in 'B4J Questions' started by victormedranop, Jun 4, 2019.

  1. victormedranop

    victormedranop Well-Known Member Licensed User

    I need to maintain some variables in every form win b4j, i am using sqlite for that.
    is there a better way to do that ?


    Victor
     
  2. OliverA

    OliverA Well-Known Member Licensed User

    I think your problem is a great fit for SQLite. If you don't want to maintain the SQL syntax between storing and retrieving your date, you could look into KeyValueStore2 and let it handle all the details for you (underneath, it uses SQLite). Plus, your stored data is encrypted (if that is a requirement). If you do not need to store the data between program executions, you could still use SQLite, but have it create in-memory database(s) only (without writing to disk). Since the source is available for KeyValueStore2, you could modify it to use a in-memory database.

    Link(s):
    https://www.b4x.com/android/forum/t...imple-powerful-local-datastore.63633/#content
    https://www.sqlite.org/inmemorydb.html
     
    victormedranop likes this.
  3. MarkusR

    MarkusR Well-Known Member Licensed User

    OliverA likes this.
  4. victormedranop

    victormedranop Well-Known Member Licensed User

    Can you show me how ? some example

    Victor
     
  5. OliverA

    OliverA Well-Known Member Licensed User

    If you go that far to write your own read write methods to serialize data to store and to retrieve your data and de-serialize it, why not just stick with KeyValueStore2? I do agree though that if writing is not needed, a class, declared globally, should suffice.
     
    victormedranop likes this.
  6. MarkusR

    MarkusR Well-Known Member Licensed User

    because often u have a class with functionality & data and typically you will save/load this by a own Sub or the easy way as Object to File.
    b4xserializator is also a cool way for transport a object (or object list) via network from app to app.
     
    OliverA likes this.
  7. MarkusR

    MarkusR Well-Known Member Licensed User

    i tried
     

    Attached Files:

    victormedranop likes this.
  8. victormedranop

    victormedranop Well-Known Member Licensed User

    i like it.

    Thanks.
     
  9. victormedranop

    victormedranop Well-Known Member Licensed User

    I will try both scenario an check for speed and complex of the solutions.

    victor
     
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