tags:

views:

163

answers:

2

Hi,

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.

A: 

You can add 'extras' to the Intent you use to start the Activity using the putExtra methods and retrieve the values using the getExtras method.

This mechanism should be used to pass small (meta-, or parameter-like) data to activities. For bigger data structures it is common to pass an Uri that identifies the data.

Josef
Thanks for your response.And i tried with the Intent stuff , but it is not working for me.Can you please give some code snippet.
Rajapandian
A: 

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.

CommonsWare