本文介绍了来自服务的 StartActivityForResult的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢在这个例子中启用蓝牙.
然而,我的班级不是活动而是服务,因此我无法调用 startActivityForResult.我怎么解决这个问题?.我知道还有其他问题已得到解答,例如
However my class isnt a Activity but a Service and therefore I can't call startActivityForResult. How can i solve this problem?. I know there are other questions that have been answered like
但这并不能解决我的问题,因为我的应用程序由服务组成,仅此而已.
but this doesn't solve my problem because my application consists of the service and nothing else.
推荐答案
很遗憾,您不能这样做.
Unfortunately you can't do that.
我找到的唯一解决方案(hack)是首先打开一个具有 Dialog 样式的 Activity
,然后在那里进行调用.
The only solution I found (hack) is to first open an Activity
with a Dialog style and then do the call there.
这篇关于来自服务的 StartActivityForResult的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!