我正在尝试从内部类访问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)
this@SplashScreen.finish()
}
}
}
2条答案
按热度按时间xdyibdwo1#
试试这个
或
w8rqjzmb2#
这可以通过如下更改SplashTimerTask来解决
并在SplashScreen中调用,如下所示