What is the equivalent of setTimeOut() javascript to Android?

后端 未结 4 1499
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 23:59

I need the equivalent code of setTimeOut(call function(),milliseconds); for android.

setTimeOut(call function(),milliseconds);
4条回答
  •  感动是毒
    2021-02-07 00:56

    As a continuation to Valentyn answer using java underscore:

    Add dependency to gradle:

    dependencies {
        compile group: 'com.github.javadev', name: 'underscore', version: '1.15'
    }
    

    Java:

    import com.github.underscore.lodash.$;
    
    $.setTimeout(new Function() {
        public Void apply() {
            // work
            return null;
        }
    }, 1000); // 1 second
    

提交回复
热议问题