I have an android app that works with greenDAO, and I'm trying to get all the databases (kind of like show databases
in MySQL), to show in a RecyclerView
, when the user selects an item then get all the entities inside the database selected an show them in another fragment and then when the user selects an entity then get all the data and show it in another fragment.
Is there a way to get that information with greenDAO? Another way to get it?(sqlite maybe?) or the only way is to show what's already there(in terms of databases and entities) and change it accordingly to how and when the databases and number of entities change?
went with an sligthly better version of option 3(show what's alerdy there and change it acordign to how and when the databases and number of entities change) where i created a class that initializes all databases and entities(DaoMaster.DevOpenHelper,SQLiteDatabase and entityNameDao), there, i get the database name and create a list of every entity and pass it to the activity, and from there, get the list of data from the entity with de Dao. not the way i wanted to make it but at least it's not a mess to update.
Edit:ok so after a while i found that you can get all that data with Sqlite, all except all the databases. For the tables or entities you can query
SELECT name FROM sqlite_master WHERE type='table'
, now with all the table names you can query each table, for getting the data you have to first get the atributes with theCursor.getColumnNames();
and then get them withgetColumnIndex();
here's a little example