Opening and updating activity from broadcast receiver
<p>i am receiving sms from emulator in a BroadCastReceiver called SmsRceiver. now i want to show this message on a text view inside an Activity. to open an activity i am sending another broadcast from my SmsReciever.but i am getting the following error</p>

<pre><code>getOrCreateThreadId cursor cnt: 1
01-31 03:28:04.562: W/NotificationService(68): STOP command without a player
01-31 03:28:04.652: D/MediaPlayer(68): Couldn't open file on client side, trying server side
01-31 03:28:04.652: E/MediaPlayerService(33): Couldn't open fd for content://settings/system/notification_sound
01-31 03:28:04.662: E/MediaPlayer(68): Unable to to create media player
01-31 03:28:04.662: W/NotificationService(68): error loading sound for content://settings/system/notification_sound
01-31 03:28:04.662: W/NotificationService(68): java.io.IOException: setDataSource failed.: status=0x80000000
01-31 03:28:04.662: W/NotificationService(68):  at android.media.MediaPlayer.setDataSource(Native Method)
01-31 03:28:04.662: W/NotificationService(68):  at android.media.MediaPlayer.setDataSource(MediaPlayer.java:737)
01-31 03:28:04.662: W/NotificationService(68):  at android.media.MediaPlayer.setDataSource(MediaPlayer.java:692)
01-31 03:28:04.662: W/NotificationService(68):  at com.android.server.NotificationPlayer$CreationAndCompletionThread.run(NotificationPlayer.java:88)
</code></pre>

<p>SmsReceiver.Java</p>

<pre><code>package com.blogspot.uappmarket.smschat;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.widget.Toast;

public class SmsReceiver extends BroadcastReceiver {
    String from,message = "";
    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        Object[] pdus = (Object[]) bundle.get("pdus");
        SmsMessage[] sms = new SmsMessage[pdus.length];
        from += SmsMessage.createFromPdu((byte[]) pdus[0]).getOriginatingAddress();
        for (int i=0; i&lt;sms.length; i++){
            sms[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
            message+=sms[i].getMessageBody();
        }
        Intent broadcastIntent = new Intent();
        intent.setAction("SMS_RECEIVED_ACTION");
        intent.putExtra("from", from);
        intent.putExtra("message", message);
        context.sendBroadcast(broadcastIntent);
    }
}
</code></pre>

<p>ReceiveSms.Java</p>

<pre><code>package com.blogspot.uappmarket.smschat;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.widget.TextView;

public class ReceiveSms extends Activity{

    TextView tvFrom,tvMessage;
    BroadcastReceiver MessageReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            //tvFrom.setText("One Message Received");
        }
    };
    IntentFilter filter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.receive_sms);
        tvFrom = (TextView) findViewById(R.id.tvFrom);
        tvMessage = (TextView) findViewById(R.id.textView2);
        filter= new IntentFilter("SMS_RECEIVED_ACTION");
    }

    @Override
    protected void onResume() {
        super.onResume();
        registerReceiver(MessageReceiver, filter);
    }

    @Override
    protected void onPause() {
        super.onPause();
        unregisterReceiver(MessageReceiver);
    }
}
</code></pre>
