difference between Thread and Handler

后端 未结 5 502
耶瑟儿~
耶瑟儿~ 2020-12-23 17:08

Can somebody tell me the deference between Thread and Handler? When we use Thread and when we use Handler?

I have two code in my project , But I can\'t understand th

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 17:50

    Simply says,

    Both are same concepts, but some key differences. Thread is a java(java.lang) concept and Handler is a android(android.os)OS concept.if you are using Handler instead of Thread , your OS will automatically manage the working of background processes. But if you are using Thread,it is not dependent on your android OS. So Threads can't manage memory efficiently as compared to Handler.

提交回复
热议问题