I'm working on my first android app. It's a companion app for a video game, and it should come with preloaded data. I'm not entirely sure how to best go about this. I apologize if this has been asked before but I tried searching for a few different keywords and nothing is jumping out at me.

So I've got a basic data model, created some objects and their fields, but those objects should have "base" or "starter" data in them and I don't know how to best approach this.

For example: I have an object called 'Character'. The game currently has 12 characters, each of them share a set of basic properties (Health, Stamina, Strength, etc), but each character has a different value for those properties. So I've created a Java class for Character, with all of the fields laid out and a default constructor, etc.

Where I'm stuck is... the 12 base characters. I want the user to be able to select one of the characters from the list, but as of right now, it's just an object structure - there aren't any actual characters to choose from/query from a database. I could hard code the data in the classes, but that's not very welcoming of expansion. So I've been looking at leveraging the SQLite database and creating a table to hold the individual characters and their attributes.

I can create a new table in SQLite with the necessary columns, I can insert rows into that table, and I can query for that table - great. However, I don't know how I can populate that table with the appropriate data without the user invoking some sort of onClick event that runs a method to insert it.

So I guess basically what I'm asking is - how do I get my basic database structure setup during app installation? Or am I thinking about this entire process incorrectly?

1 Answer 1


Have your APP include a data file with the default characters.

When the APP starts it reads the default data file and populates the list of choices.

Next it looks for the next data file, which will not exist at first.

When the APP runs out of data files it exits the loop and permits the user to choose one of the characters.

In the future, when new characters are developed, the user can download an 'additional character package' this will install next to the default characters in the same directory.

When the APP is next started it will notice the additional file and simply repeat the loop, loading the additional characters.

Next the APP will again check for additional data files, once it runs out it exits the loop and let's the user choose from the larger list of characters.

Don't forget to include a provision to delete or uninstall the additional characters in case there's an error in the data and an updated character package needs to be installed.

The same principle can be used for tools, costumes, weapons, etc. The user can separately download additional packs to upgrade the 'game engine' without needing to update the original program.

  • I think suggesting some options for storing the data might be helpful to fully answer the question
    – Adam B
    Sep 13, 2018 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.