Thoughts on managing DB template for multiple DBs within app?

Discussion in 'Android Applications Discussions' started by Guitarist, Dec 31, 2019.

  1. Guitarist

    Guitarist New Member

    Joined:
    Dec 27, 2019
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    I could use some thoughts or insights on the best approach to handing multiple SQLite DBs for an Android app. I have an existing Java application that acts as a Research tool and I want to convert it to an Android app. I'm new to Android development and could use some ideas on the best approach.

    About the App:
    The existing Research DB is an app that allows a user to create a subject oriented database for research that requires the user to document a source for each note on the subject... literally as if doing research or as you would for a thesis or research paper. Sources can be books, videos, articles, online resources, etc. and files can be attached. So there is a blank template database (i.e. blank.db) that is copied and renamed to the subject the user chooses to research. The SQLite template database contains 11 tables linked to a Notes table. The remaining 10 tables are Sources, Authors, Author_by_Source, Comments, Quotes, Terms, Topics, Files, File_by_Note, Questions.

    However, a user can delete or destroy any database they wish except the blank.db and sample.db which come with the app.

    I attached a Zip file example of the blank.db (SQLite)

    What have I done:
    I've have been reading and doing hands-on tutorials learning the Android C.R.U.D approach through the DatabaseHelper, which is so cool and so simple. I've also learned about the Asset folder and storing databases already created within a sub folder called databases. I already see room for improvement to my existing app. So this where I ask my question(s).

    So the Discussion Questions:
    What is the best way to handle creating new databases?
    Currently, a blank.db template is copied and renamed. The user simply selects from a menu "Create New Database" and provides a name for it. Then the blank.db is copied and renamed. However, I'm thinking it should just be programmatically created every time... thoughts?

    Would there be a good book or online resource (or pattern) on how to handle this type of database creation/template and management?

    Do I manage everything through the Assets folder?
    Lastly, in my Java app, I had to create all the necessary directories and push the necessary files and DBs upon first install. The app then links to and manages all those sources for recalling and managing user setup, DBs etc.
     
  2. JandN2639

    JandN2639 Active Member

    Joined:
    Jan 19, 2017
    Messages:
    229
    Likes Received:
    57
    Trophy Points:
    43
    Ratings:
    +62
    Please move this to a forum for app development.


    Sent from my iPhone using Tapatalk
     
  3. Guitarist

    Guitarist New Member

    Joined:
    Dec 27, 2019
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    Sorry, I see I chose the wrong forum. How do I move a post? I couldn't find a help on how to do that.
     
  4. JandN2639

    JandN2639 Active Member

    Joined:
    Jan 19, 2017
    Messages:
    229
    Likes Received:
    57
    Trophy Points:
    43
    Ratings:
    +62
    @Sajo, can you help?


    Sent from my iPhone using Tapatalk
     
  5. Sajo

    Sajo Diamond Member

    Top Poster Of Month

    Joined:
    Jan 25, 2013
    Messages:
    14,940
    Likes Received:
    12,100
    Trophy Points:
    2,463
    Location:
    Tennessee
    Ratings:
    +12,659
    Current Phone Model:
    Moto Z4
    Help with what? I see that the post was already moved to the App Development thread.

    And FYI...I am not a moderator or admin, so I can't help with moving posts from one thread to another.

    Sent from my moto z4 using Tapatalk
     
    #5 Sajo, Dec 31, 2019
    Last edited: Dec 31, 2019