I'm moving my ContentProvider android codes to kotlin.
These codes were converted from kotlin plugin.How to access TABLE_NAME in this codes?
If i access like DataContract.Items.TABLE_NAME(as in original java codes), there will be 'Unresolved reference: TABLE_NAME' error .
Better ways are welcome.
val table_name = DataContract.Items.TABLE_NAME
public trait ItemsColumns {
class object {
public val TABLE_NAME: String = "items"
}
}
public class DataContract() {
class object {
public class Items() : ItemsColumns {
class object {
public val TEMP: String = “temp”
In Java, static fields are inherited, in Kotlin they do not exist as such (only instance properties of class objects exist), and are not inherited. This is done to avoid many puzzlers described in this book: http://www.javapuzzlers.com/