How to start a different activity with some delay after pressing a button in android?

后端 未结 7 682
感动是毒
感动是毒 2020-12-30 04:14

I want that a new activity should start with some delay on pressing a button. Is it possible to do that , and whats the procedure.

相关标签:
7条回答
  • 2020-12-30 04:52
    runOnUiThread(new Runnable() {
            @Override
            public void run() {
                new Handler().postDelayed(new Runnable(){
                    @Override
                    public void run() {
                        Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                        startActivity(intent);
                    }
                }, 4000);
            }
        });
    
    0 讨论(0)
提交回复
热议问题