【问题标题】:Getting the result of an Activity inside a Service在 Service 中获取 Activity 的结果
【发布时间】:2012-06-26 15:57:55
【问题描述】:

如何在服务中获得已启动该活动的活动的结果?

例如:服务 S -> 启动 -> 活动 A。现在我想将例如布尔结果发送回服务。这可能吗?

问候,

罗伯特

【问题讨论】:

    标签: android service android-intent android-activity


    【解决方案1】:

    再次调用startService(),将布尔结果打包为Intent extra,服务将在onStartCommand() 中获取。

    请注意,让服务启动 Activity 是不寻常的,并且可能不是用户所希望的,尤其是当他们正在做其他事情时。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多