import android.os.Handler;import android.os.HandlerThread; HandlerThread threadJd = new HandlerThread("threadJd"); threadJd.start(); Handler jdHandler = new Handler(threadJd.getLooper()); Runnable task = new Runnable() { @Override public void run() { jdHandler.postDelayed(this::run,1000);//设置循环时间,不能设置太快 循环内容 } }; jdHandler.post(task);
参考:https://blog.csdn.net/qq_37746927/article/details/101270398
来源地址:https://blog.csdn.net/gls_nuaa/article/details/132571511