0

I am trying to make a Ledger app in which there would one base table which would contain the name, phone number etc and a table containing all list of transaction corresponding to a particular person. Now I don't know how many persons I would add so tables need to be created during run time. But how should I do that?

I even tried a second where I would keep the tranctionId column as a foreign key in the base table and use it as a primary key in another table where all transaction would be stored in a mutableListOf<>() but it showing an error that use type convertors.

Please tell how should proceed or if there is some other way for such cases.

1 Answers1

0

so tables need to be created during run time

Sorry, but Room does not support that directly. You can call getOpenHelper() on your RoomDatabase and do that stuff manually if you want. A more conventional approach is to have one table for all persons, with a person's ID as being one column in that table.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • There was an error **use type converter **when I tried the second method( I mentioned it in the second portion of the question). What about that can that be solved anyway ? –  Apr 06 '20 at 12:42
  • @AshutoshPanda: Well, any manually-created tables will have to be consumed manually as well. – CommonsWare Apr 06 '20 at 12:45