Display toast on Android broadcast when screen is on.
<p>Im trying to do a simple broadcast in Android to detect the screen is on. For me this is a learning excersize to understand the Android broadcast capabilities. Please help.
I have the Android XML</p>

<pre><code>  &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
        &lt;activity android:name=".UsbddActivity"
                  android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;

        &lt;/activity&gt;


    &lt;receiver android:name=".BootReceiver"&gt;
  &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.SCREEN_ON"&gt;&lt;/action&gt; 


  &lt;/intent-filter&gt;
&lt;/receiver&gt;
    &lt;/application&gt;
</code></pre>

<p>The main Java file</p>

<pre><code>package usb.usbd;
import android.app.Activity;
import android.os.Bundle;
public class UsbddActivity extends Activity {

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

<p>The Broadcast class That supposed to display the toast. </p>

<pre><code>package usb.usbd;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class BootReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context arg0, Intent arg1) {

        Toast.makeText( arg0, "worked", Toast.LENGTH_LONG).show();
        run(arg0 );

    }
    public void run(Context arg0 ) { 
          Toast.makeText(arg0, "sss", Toast.LENGTH_SHORT).show(); 
        } 


}
</code></pre>

<p>It doesnt dislay any errors nor does it display the toast. How can i get the toast to display when the screen is turned on.</p>
