What happens to an Android thread after the Activity that created it is destroyed?

前端 未结 4 1891
一向
一向 2021-02-07 04:25

In my Android app, the main Activity will sometimes start a Thread to load data from a server. This thread modifies the app\'s database and edits some important files. AFAIK,

4条回答
  •  时光取名叫无心
    2021-02-07 05:15

    It sounds like you should move the db updating to a Service. Once an Activity goes to the background, Android assumes its process can be killed off if necessary and restarted later without ill effect. See Application Fundamentals for more info.

提交回复
热议问题