How to show a view for 3 seconds, and then hide it?

后端 未结 4 635
北恋
北恋 2020-12-23 22:23

I tried with threads, but android throws \"CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.\".

So how can

4条回答
  •  情话喂你
    2020-12-23 22:32

    I know this is a stretch, but here's an answer with coroutines if you happen to use them:

        lifecycleScope.launch {
            delay(3000)
            header.visibility = View.GONE
        }
    

提交回复
热议问题