在我的情况下,有没有办法在Android Studio中执行wait()函数?
function example ()
{
while ()
{
//do something
//wait (x seconds) then go back
}
}
答案 0 :(得分:2)
你可以这样做:
//in your method, use the Timer Schedule function:
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
//TODO: do something here of your interest.
}
},
2000
);
这里我保持延迟2秒(2000毫秒)。您可以根据需要进行更改。
答案 1 :(得分:0)
var mySchema = new Schema({
// ...
});
var myModel = mongoose.model('MyModel', mySchema);
myModel.a = 1;