如何从BroadcastReceiver的android系统中发送数据到一个活动? [英] How to send data from BroadcastReceiver to an Activity in android?

查看:118
本文介绍了如何从BroadcastReceiver的android系统中发送数据到一个活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个应用程序侦听在Android上的短信收件箱活动和一个的BroadcastReceiver 。照片当短信来接收器是显示警告信息时...

但我想从接收器发送邮件信息的活动。照片我不知道如何实现这一目标。
任何人知道它,请帮我...

解决方案
  

我写一个应用程序来听   在短信收件箱中的机器人有一个   活动一BroadcastReceiver的。

请不要做这。这不是Android SDK的一部分。您的应用程序将打破在某些手机上。您的应用程序可以在Android中的未来版本打破。

但我想从接收器发送邮件信息的活动。

发送另一个广播意图,这一个私人之一在自己的应用程序,其中活动已使用注册的的BroadcastReceiver (通过 registerReceiver())为您的私人意图

I am writing an application to listen the SMS inbox in Android with one Activity and one BroadcastReceiver.
Once the SMS comes the Receiver is showing Alert message...

But i want to send the message information from Receiver to Activity.
I don't know how to achieve this.
Anybody knows it please help me...

解决方案

I am writing an application to listen the SMS inbox in android with one activity and one BroadcastReceiver.

Please do not do this. This is not part of the Android SDK. Your application will break on some phones. Your application may break in future editions of Android.

But i want to send the message information from Receiver to Activity.

Send another broadcast Intent, this one a private one for use within your own application, where the Activity has registered a BroadcastReceiver (via registerReceiver()) for your private Intent.

这篇关于如何从BroadcastReceiver的android系统中发送数据到一个活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆