What is the correct usage of Alarmmanager and starting boot?
<pre><code>  public class main extends Activity {
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ///////////Do something////////////////////////
    showtext.startScan();
    //SEt Alarm
    Intent intent = new Intent(this, TextReceiver.class);
    PendingIntent pi=PendingIntent.getBroadcast(this, 0, intent, 0);
    AlarmManager am=(AlarmManager) getSystemService(Context.ALARM_SERVICE);
    am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+9000, pi);}}


/////////////////////////////////////////////////////////

public class TextReceiver extends BroadcastReceiver{

public void onReceive(Context context, Intent intent) 
{
///Show text/////
Intent myintent = new Intent(context, main.class);  
myintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myintent);
}
}
</code></pre>

<p>First, my when I run the program after 9sn, I am getting an error that "The app stopped unexpextdly." . My goal is to show the text every 9sn Why I get this error ? </p>

<p>Second, I want to run my program staring boot. Also, I register my manifest to start my broadcast receiver. 
The problem is that after i turn off the device, it starts with error and says "the app is stopped" 
I think this line "context.startActivity(myintent);" causes the error, but What should i use instead ? </p>
