I am trying to create an application which requires a two table SQLite database with a one to many relationship.
Basicly the first table will allow a user to create an employee, when they will tap on the employee it will take them to a second activity which will allow users to add multiple phone numbers for that employee which is stored in a second table.
I don’t really know where to start,regarding creating a database with two tables and a relationship. Every example I seem to come across only deminstrate a one table database connection.
I would be greatful for any help/advice/a tutorial which demos this kind of functionality.
This tutorial leads me to successfully creating DAO class implementation: http://www.vogella.de/articles/AndroidSQLite/article.html
There’s no enforced relationship though, I heard it’s not good for performance anyway so I stop looking.
I end up having one DBHandler that keep tracks of DB version for create/update tables.
I also have DBOpenHelper for help opening/close connections.
Since I have two tables (for the purpose of example I will stick with Employee and Contact), I have one DAO of each type both contain DBOpenHelper.
Hope this helps 🙂