new Runnable() but no new thread?

前端 未结 8 2187
名媛妹妹
名媛妹妹 2020-12-08 11:11

I\'m trying to understand the code here , specifically the anonymous class

private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
   final l         


        
8条回答
  •  生来不讨喜
    2020-12-08 11:32

    Runnable is often used to provide the code that a thread should run, but Runnable itself has nothing to do with threads. It's just an object with a run() method.

    In Android, the Handler class can be used to ask the framework to run some code later on the same thread, rather than on a different one. Runnable is used to provide the code that should run later.

提交回复
热议问题