我在 Android Developer 中阅读了很多内容,但我没有完全理解这 3 个“想法”:
1) 上下文
2) 构建器
3)服务
它们之间有何关系?
我看到例如:
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(context)
我并没有确切地了解每个“想法”的一般目的。
最佳答案
GoogleApiClient.Builder
是一个配置并返回 GoogleApiClient
实例的类。术语Builder指的是Builder模式。
Context
顾名思义:想要使用框架特定功能的谁或什么。
Service
是一个无需前端 UI 即可执行操作的组件。 Service
或 Activity
可以提供 Context
的实例作为 MyService.this
或 MyActivity.this
.
how do they relate to each other?
您似乎正在尝试通过 Android Service
执行与 Google Play 服务相关的操作。
关于java - Android 服务、上下文、构建器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28943670/