String loss in alarm manager
<p>I have a problem with a text string attached to an alarm. It seems that when the alarm is triggered, the string attached to the alarm is null. Clearly I have made a mistake - but don't know where.</p>

<p>My code for setting the alarm is;</p>

<pre><code>static void set_alarm(long alarm_time_in_millis,Context cont,AlarmManager alarm_manager,String str)
{
    Intent intent = new Intent(cont, to_call_when_alarm_goes_off.class);
    intent.putExtra("string_passed_in_bundle", str); 

    Log.i("xx","set_alarm ["+str+"]"); // The string I see in the Log is correct
    PendingIntent pIntent = PendingIntent.getBroadcast(cont,0, intent, 0);

    alarm_manager.cancel(pIntent);

    alarm_manager.set(AlarmManager.RTC_WAKEUP,alarm_time_in_millis, pIntent);
}
</code></pre>

<p>The code for receiving the alarm is as follows:</p>

<pre><code>public class to_call_when_alarm_goes_off extends BroadcastReceiver
{
    Bundle bundle_from_whoever_called_this_activity;

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

        bundle_from_whoever_called_this_activity = arg1.getExtras();

        str = bundle_from_whoever_called_this_activity.getString("string_passed_in_bundle");

        Log.i("xx","to_call_when_alarm_goes_off: TIME TO WAKE UP!!! ["+str+"]");

        try 
        {
            Intent i = new Intent(arg0, dingaling.class);
            i.putExtra("string_passed_in_bundle", str);
            i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            arg0.startActivity(i);
        } 
        catch (Exception e) 
        {
        }
    }
}
</code></pre>

<p>When I set an alarm and then wait for it to be triggered, the log file will show something like this</p>

<pre><code>set_alarm [Go to meeting]
to_call_when_alarm_goes_off: TIME TO WAKE UP!!! [null]
</code></pre>

<p><strong>EDIT:</strong> Could there be some "super." function I've forgotten to call?</p>

<p><strong>EDIT:</strong> I often get confused about what kind of context to pass to various functions, e.g. getBaseContext(),getApplicationContext(),"this" etc... If I had the wrong kind of context involved somewhere, could that cause this problem?</p>
