Hi
Before: in java I had 2 Booleans directly under the main class of main activity, and they were imported to the preference activity
after converting to Kotlin
they went under companion object
//Main activity
class MainActivity : AppCompatActivity() {
companion object {
var bOne: Boolean? = true
var bTwo: Boolean? = false
}
...
}
//Preference activity
import jcalc.app.nhk.MainActivity.bOne
import jcalc.app.nhk.MainActivity.bTwo
they work in the main activity but their import doesn’t work anymore in the preferences activity class
when under companion object
: Error Unresolved reference
when under the class directly: Error Cannot Import 'bOne', functions and properties can be imported only from packages or objects
going under companion object is legit but what should i do to fix the Unresolved reference
error? sorry i’m new to kotlin