startActivityForResult

startActivityForResult

本文介绍了从一个服务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

http://stackoverflow.com/questions/2848775/use-startactivityforresult-from-non-activity

但这并没有解决我的问题,因为我的应用程序由服务而不是其他的。

but this doesn't solve my problem because my application consists of the service and nothing else.

推荐答案

不幸的是,你不能做到这一点。

Unfortunately you can't do that.

我发现的唯一的解决办法(黑客)是先打开活动一个对话框样式,然后做呼叫那里。

The only solution I found (hack) is to first open an Activity with a Dialog style and then do the call there.

这篇关于从一个服务StartActivityForResult的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 07:31