Android Question App settings advice

Discussion in 'Android Questions' started by RB Smissaert, Apr 8, 2018.

  1. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Developing a simple database app in B4A.
    Currently I handle application settings with File.ReadMap and File.WriteMap etc. and this seems to work well. What are the benefits of using instead the PreferenceActivity or AHPreferenceActivity libraries?

    RBS
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The better alternative of File.WriteMap is KeyValueStore 2.

    The purpose of PreferenceActivity is to allow the user to change the settings.
     
  3. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Ok, in what way is it better?
    I can let the user change the settings via a menu or a dedicated settings page, using File.WriteMap for persistence.
    I will look into KeyValueStore 2, but I like the simplicity of File.WriteMap and File.ReadMap. Similar to an .ini file and
    I am used to that.

    RBS
     
  4. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    But I can write the Map data to a text file. I can see though that if there are a lot of settings, a database for storage has benefits, eg.
    multiple text replacements. Will switch to KVS2 and see how it works.

    RBS
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    KVS is better than File.WriteMap because it supports complex data types.
     
  6. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    OK, thanks. Yes, that could be handy, saving me the conversion to and from strings.
    You convinced me now.
    Not sure yet about PreferenceActivity or AHPreferenceActivity.

    RBS
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    BTW, there are cases where File.WriteMap / ReadMap are more appropriate. For example in B4J apps it can be useful for configuration files as the user can modify it with a text editor.
     
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