KotlinLeaner
07/28/2022, 8:57 AMcompanion object {
const val TABLE_USER_ATTRIBUTE_EMPID = "_id"
const val TABLE_USER_ATTRIBUTE_DATA = "data"
}
vs
object DbConstants {
const val TABLE_USER_ATTRIBUTE_EMPID = "_id"
const val TABLE_USER_ATTRIBUTE_DATA = "data"
}
which is one recommended way ?Jiddles
07/28/2022, 4:18 PMDatabase
and it was the best place to store the consts (e.g. cos it might be the only place it’s used), I’d use companion object in that class
However if there’s no one place suited to store your constants , go with the second approach
There really isn’t much different between the 2 approaches to be honest