Android的 - 在后台运行 - 服务与标准的java类后台、标准、Android、java

2023-09-12 04:37:40 作者:酒顾以终

在Android的,如果我想要做一些后台的工作,是什么

In Android, if I want to do some background work, what is the difference between

创建服务做的工作,并具有活动启动服务 VS. 创建一个标准的Java类做的工作,并具有活动创建一个类的对象,并调用方法,做的工作在不同的线程。

Creating a Service to do the work, and having the Activity start the Service VS. Creating a standard java class to do the work, and having the Activity create an object of the class and invoke methods, to do the work in separate thread.

推荐答案

做你自己的线程是矫枉过正,没有针对此解决方案,使您不必担心并发的坚硬的部分。看一看 AsyncTask的或的