谁能告诉我,如果存在的android一个等价的setInterval / setTimeout的?没有任何人有关于如何做到这一点任何的例子吗?
Can anyone tell me if an equivalent for setInterval/setTimeout exists for android? Does anybody have any example about how to do it?
在此先感谢!
像往常一样与Android有办法做到这一点的负载,但假设你只是想在同一个线程点点后运行一段codeA ,我用这样的:
As always with Android there's loads of ways to do this, but assuming you simply want to run a piece of code a little bit later on the same thread, I use this:
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
Log.i("tag", "This'll run 300 milliseconds later");
}
},
300);
..这是pretty的多少等同于
.. this is pretty much equivalent to
setTimeout(
function() {
console.log("This'll run 300 milliseconds later");
},
300);
上一篇:使用这两款相机在Android上:"无法连接到相机服务"相机、两款、连接到、Android
下一篇:Android的,Drawable.createFromStream(是,源名):什么是第二个参数的含义?第二个、含义、参数、Android