I'm developing a vocab building app that stores data into an SQLite database. I have a category for different types of vocabulary, for example, a category for GMAT. Each of this category is an activity and has its own table where I store a list of default vocab. The classes for these categories all extend an abstract class full of methods for the menu option items, such as search, add, and delete vocab functionalities.
Now I have 4 categories which mean I have 4 tables in my SQLite database and an activity for each of the categories. However, I want to allow the user to be able to add new categories as they click on a button. The newly added category will be identical to the 4 categories I have already created. So any newly added category will have the same layout, menu items, and functionalities. I have thought of one solution which is to create these categories first but make it invisible to the users and only show them to the user when the user performs an action to add new categories. In this case, I'll create the activities and tables in advance and just hide them in the beginning. However, with this solution, there will be a limit to the number of categories that the user can add, which is ok but not optimal. It also will cause me to create a lot of potentially unused activities which seems very inefficient.
I have come across posts like this and this, but it doesn't address my problem. If I'm not clear with articulating my problem, it is like the music Spotify software, where I don't know how to allow the user to add new playlists dynamically. Thank you so much for your help in advance!
Update: with juergen's suggestion, I can redesign my database to just have one table. So I no longer need to create tables dynamically, but I still have to find a way to create multiple instances of an activity dynamically.
ListViewand theSpinnerholding all the categoriesSpinnerwith aSimpleCursorAdapterpassing aCursorthat holds all the categories you have in your table, after selecting any category update the words for yourListView(also usingSimpleCursorAdapter)