Android - IContentService 无法解析
Android - IContentService cannot be resolved
在我的项目中,我需要使用 IContentService,并且我使用了正确的导入(导入 android.content.IContentService),但 android 工作室告诉我 'Cannot resolve symbol IContentService'。
我知道 IContentService 是一个实际的 class,因为它在 ContentResolver.getContentService();
中使用
有人知道我怎样才能让这个导入工作吗?
您不能直接使用此 class。
您可以在源代码(例如here for Marshmallow)中看到此class 被标记为@hide
注释。
class 只能通过反射使用,如 here 所示(尽管它有所有缺点)。
顺便说一句:ContentResolver.getContentService()
也是一个隐藏方法(见here)。
在我的项目中,我需要使用 IContentService,并且我使用了正确的导入(导入 android.content.IContentService),但 android 工作室告诉我 'Cannot resolve symbol IContentService'。
我知道 IContentService 是一个实际的 class,因为它在 ContentResolver.getContentService();
中使用有人知道我怎样才能让这个导入工作吗?
您不能直接使用此 class。
您可以在源代码(例如here for Marshmallow)中看到此class 被标记为@hide
注释。
class 只能通过反射使用,如 here 所示(尽管它有所有缺点)。
顺便说一句:ContentResolver.getContentService()
也是一个隐藏方法(见here)。