How to pause / sleep thread or process in Android?

后端 未结 12 876
故里飘歌
故里飘歌 2020-11-22 05:49

I want to make a pause between two lines of code, Let me explain a bit:

-> the user clicks a button (a card in fact) and I show it by changing the background of thi

12条回答
  •  情歌与酒
    2020-11-22 06:52

    I use this:

    Thread closeActivity = new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          Thread.sleep(3000);
          // Do some stuff
        } catch (Exception e) {
          e.getLocalizedMessage();
        }
      }
    });
    

提交回复
热议问题