Open1

Kotlinで一定周期の関数実行

sho_ichisho_ichi
class MainActivity : AppCompatActivity() {
    //execute_in_10_seconds_cycle
    val hndler10s = Handler(Looper.getMainLooper())
    val rnb10s = object : Runnable{
        override fun run() {
            //10秒周期で実行
            hndler10s.postDelayed(this,10000)
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        //execute_in_10_seconds_cycle
        hndler10s.post(rnb10s)
    }
}

Handlerの使い方
deprecationへの対処
非同期処理
とりあえずうごくが、よく分からん