Alarmmanager with pending Intent
<p>The code snippet below....       </p>

<pre><code>    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);}
</code></pre>

<p>And my Receiver </p>

<pre><code>TextReceiver extends BroadcastReceiver{

public void onReceive(Context context, Intent intent) 
{
///Show text/////
}
}
</code></pre>

<p>The thing is that 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 ? 
What is the correct usage of alarmmanager in the main activity ? 
OR Should I set alarm in the BroadcastReceiver ? 
Which one does make sense am.setRepeating or am.set in terms of my goal ? </p>

<p>*<em>Edit: How can I change my alarm code to run in the Broadcast Receiver ? *</em></p>
