我想升级此代码以使用lambda表达式:Handler handler = new Handler(Looper.getMainLooper());handler.postDelayed(new Runnable() { @Override public void run() { missileX = ufoX; resetRecent(); waitForUfoTimer = false; }}, randomize(20000, 18000));我以这种方式尝试,但无法编译:Handler handler2 = new Handler(Looper.getMainLooper());handler2.postDelayed(Runnable task = () -> { missileX = ufoX; resetRecent(); waitForUfoTimer = false; }}, randomize(20000, 18000));在哪里有一些说明,以便我可以学习如何做?我必须猜测语法是荒谬的。
添加回答
举报
0/150
提交
取消