I was trying to register a broadcastreceiver with the code below but I
always get a null when I return from registerReceiver.


public class ReceiverTest extends Activity
{
        private IntentFilter intentFilter = new
IntentFilter(Intent.ACTION_CAMERA_BUTTON);
        private BroadcastReceiver receiver = new BroadcastReceiver()
        {
                @Override
                public void onReceive(Context rcv, Intent intent)
                {

                }
        };

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

                if (registerReceiver(receiver, intentFilter) == null)
                {
                        Toast.makeText(this, "Same old", 
Toast.LENGTH_LONG).show();

                }//end of if
    }
}


There must be some little thing I am missing, but I cannot figure it
out.  I have run this on both my phone and the emulator and the Toast
shows up everytime.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to