【发布时间】:2012-05-14 10:03:39
【问题描述】:
我读过的许多帖子都指出 Activity 应该是 DeviceAdminReceiver 的内部类,但我不明白为什么会这样。
android 文档也没有做出这样的声明,尽管他们的示例是这样的。
这是实际要求吗?如果是这样,这是否意味着它不能使用服务来调用?
【问题讨论】:
标签: android device-admin
我读过的许多帖子都指出 Activity 应该是 DeviceAdminReceiver 的内部类,但我不明白为什么会这样。
android 文档也没有做出这样的声明,尽管他们的示例是这样的。
这是实际要求吗?如果是这样,这是否意味着它不能使用服务来调用?
【问题讨论】:
标签: android device-admin
好的,找到了隐藏在示例应用程序的source code 中的答案。
/**
* <p>UI control for the sample device admin. This provides an interface
* to enable, disable, and perform other operations with it to see
* their effect.</p>
*
* **<p>Note that this is implemented as an inner class only keep the sample
* all together; typically this code would appear in some separate class.**
*/
在内部类(活动)的上方说明,这表明它不必是内部类,建议将这两个类分开。
【讨论】: