我正在尝试从内部类访问 SplashScreen 活动,如下所示。但我无法解决这个@SplashScreen
class SplashScreen : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
verifyPermissions()
}
private class SplashTimerTask : TimerTask() {
override fun run() {
val mainIntent = Intent(this@SplashScreen, LoginActivity::class.java)
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(mainIntent)
[email protected] /cdn-cgi/l/email-protection()
}
}
}
Try this
private class SplashTimerTask(val splash: SplashScreen) : TimerTask() {
override fun run() {
val mainIntent = Intent(splash, LoginActivity::class.java)
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(mainIntent)
splash.finish()
}
}
or
inner class SplashTimerTask : TimerTask() {
override fun run() {
val mainIntent = Intent(this@SplashScreen, LoginActivity::class.java)
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(mainIntent)
[email protected] /cdn-cgi/l/email-protection()
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)