sqlite - Creation of databases at run time in Android -


i using dataprovider app handle crud operations. dataprovider using sqliteopenhelper nested inner class. definitions of crud operations defined inside dataprovider , sqliteopenhelper class responsible creation of database, abc.db , defining 2 tables table1 , table2. now, when user logs in app, database created (obviously if not exists) , data user displayed using contentresolver queries , cursorloader loading lists. part have achieved.

the problem arises in multi-user scenario. suppose user decides logout , login account or register new account, data previous user retained, previous data loaded listview and/or other views fetching data database. according logic, can prevented creating new database instances each new user on same device. since contentprovider initialises database prior activity's oncreate(), find hard achieve. idea on how can implemented?

since find no other alternative means so, believe maintaining user_id column way ensure multi-user usability without interference. have implemented same , added additional where clause querues using user_id=? , logged in user user_id argument. idea of creating databases @ run time, if possible, may not necessary atleast problem statement.


Comments