What is the difference between a Headless Fragment and a Service in Android?

前端 未结 3 1935
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-28 15:08

Service

A Service is an application component representing either an application\'s desire to perform a longer-running operation while not interacting with the use

3条回答
  •  萌比男神i
    2020-12-28 15:39

    Generally speaking:

    Headless Fragments are meant to encapsulate data. Headless fragments are meant to encapsulate data which can be shared between various application components (since they can exist independently of a UI component).

    Services are meant to encapsulate processing. They are more independent (and therefore also more heavy-weight, resource wise) than fragments are; they sit at a different level of abstraction and can last longer, in a system.

    There is overlap between the two.

提交回复
热议问题