display data after every 10 seconds in Android

后端 未结 6 1049
情深已故
情深已故 2020-11-28 07:20

I have to display some data after every 10 seconds. Can anyone tell me how to do that?

6条回答
  •  离开以前
    2020-11-28 07:32

    Every 10 seconds automatically refreshed your app screen or activity refreshed

    create inside onCreate() method i tried this code will work for me

    Thread t = new Thread() {
    @Override
    public void run() {
    try {
      while (!isInterrupted()) {
        Thread.sleep(1000);
        runOnUiThread(new Runnable() {
          @Override
          public void run() {            
           //CALL ANY METHOD OR ANY URL OR FUNCTION or any view
          }
        });
      }
    } catch (InterruptedException e) {
    }
    }
    };t.start();
    

提交回复
热议问题