【发布时间】:2020-03-09 13:42:01
【问题描述】:
我正在构建一个需要检测照片中某些对象的应用。我首先将所有要检查的照片加载并保存到我的房间数据库中,并使用 ViewHolder 将其连接到我的视图。 当用户单击一个按钮时,我希望检测过程开始,并且我想为此使用 jobIntentService(因为那里可能有数千张照片)。
我的问题是 - 我如何从服务中访问视图持有者?我既需要它来实际获取文件,也需要在检测完成后更新每个文件的记录。 我试图要求将活动作为属性之一,但我收到此错误
Unable to instantiate service tech.levanter.anyvision.services.DetectJobIntentService: java.lang.InstantiationException: java.lang.Class<tech.levanter.anyvision.services.DetectJobIntentService> has no zero argument constructor
不胜感激,谢谢
【问题讨论】:
-
你必须在DetectJobIntentService中创建构造函数
标签: android android-intent service android-service jobintentservice