This message was deleted.
# android
s
This message was deleted.
r
You can ask here itself i believe!
s
Is there a way to take a Room database reference:
Copy code
database = Room
            .databaseBuilder(
                this,
                CollectDatabase::class.java,
                "collect_database"
            )
            .build()
and check if a table exists?
r
Copy code
CollectDatabase::class.java
This is the abstract class right, with dao's in it. Isn't that helpful?
s
well, yes, in my activity, the first time its launched if the table hasn't been created, it errors, and i want to create the table if it doesn't exist yet, or else skip it if it does
r
Copy code
CollectDatabase::class.java
How your this class looks like?
Copy code
database = Room
            .databaseBuilder(
                this,
                CollectDatabase::class.java,
                "collect_database"
            )
            .build()
Once you invoke this, it will create the tables. Your entities are tables.