Home > other >  Errors when I create a class in Android Studio
Errors when I create a class in Android Studio

Time:01-05

I have this code:

class SignInActivity {
    private lateinit var binding: SingInBinding
    fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = SingInBinding.inflate(layoutInflater)
        setContentView(binding.root)
    } // Start GameActivity
}

But I have errors in onCreate, layoutInflater, and setContentView: unresolved reference.

How can I fix it?

I want to fix the problem.

CodePudding user response:

You are not extending any Activity class, you should do something like

class SignInActivity : ComponentActivity() {
   ...
}
  • Related