我可以从后台服务绘制到画布吗?
我有一个后台服务,可以从某处获取数据并喜欢绘制到画布上。 该服务创建一个 Canvas 对象并使用服务中的绘制原语。 安卓允许吗?
谢谢
I have a background service that gets data from somewhere and likes to draw to a canvas.
The service creates a Canvas object and use the draw primitives on it from the service.
Does Android allow that?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
后台服务不与 UI 交互。如果您希望向用户显示某些内容,您可以让服务获取数据,并通知绘制的活动。也就是说,我不明白为什么只要不显示 Canvas 对象,服务就无法与它交互。例如,如果您只是在其上绘图然后写入磁盘,我相信这在技术上应该是可行的。
Background services don't interact with UI. If you're looking to show something to the user, you could instead have the service fetch the data, and notify an activity that draws. That said, I don't see why a service can't interact with a Canvas object as long as you're not displaying it. If you're just drawing on it and then writing to disk for example, I believe it should be technically possible.