user17338689
user17338689

Reputation:

In splash Activity there are showing error But app running

Hello everyone I am new In kotlin. I am trying to show 2 Second animation splashScreen but val intent = Intent(this, MainActivity::class.java) here showing error in java but everting working.

SplashScreen Activity

class SplashScreen : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash_screen)

        supportActionBar?.hide()

        Handler(Looper.getMainLooper()).postDelayed(Runnable{
            val intent = Intent(this, MainActivity::class.java)//here show error and tell Unresolved reference: Java
            startActivity(intent)
        },2000)
    }
}

Upvotes: 0

Views: 91

Answers (1)

Moataz
Moataz

Reputation: 667

Add ")" after ::class.java

Upvotes: 1

Related Questions