Why use a android service?

后端 未结 1 1037
闹比i
闹比i 2021-02-05 05:27

Im wondering what is the point of using a android service to do background work when you need to do a lot of things just to access any public methods or get a large chunk of dat

1条回答
  •  深忆病人
    2021-02-05 05:39

    Nitpick: an object running a threaded background task ain't precisely what's usually meant by a plain old Java object.

    If you don't care what happens to the work being done if its requesting Activity or Application is shut down, then by all means avoid services. One of the main points of Services is that they can stay alive when the user navigates away from an Activity: if you're only doing work to fill a UI ListView, by all means use e.g. an AsyncTask, as is discussed in this earlier question.

    0 讨论(0)
提交回复
热议问题