【问题标题】:Android: Device Admin: Why should Activity be an inner class of the DeviceAdminReceiver class?Android:Device Admin:为什么Activity应该是DeviceAdminReceiver类的内部类?
【发布时间】:2012-05-14 10:03:39
【问题描述】:

我读过的许多帖子都指出 Activity 应该是 DeviceAdminReceiver 的内部类,但我不明白为什么会这样。

android 文档也没有做出这样的声明,尽管他们的示例是这样的。

这是实际要求吗?如果是这样,这是否意味着它不能使用服务来调用?

【问题讨论】:

    标签: android device-admin


    【解决方案1】:

    好的,找到了隐藏在示例应用程序的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.**
     */
    

    在内部类(活动)的上方说明,这表明它不必是内部类,建议将这两个类分开。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-23
      • 2013-07-29
      • 2012-07-09
      • 1970-01-01
      • 2021-11-18
      相关资源
      最近更新 更多