Android - How to re-display Main Activity
<p>I've searched for a solution to this problem but have been unable to find one.</p>

<p>The problem I have is that an alarm is sounded OK, however the <code>MainActivity</code> has closed and is not re-displayed .</p>

<p>How can I re-display the <code>MainActivity</code> in the following code:</p>

<pre><code>public class AlarmReceiver extends WakefulBroadcastReceiver {

@Override
public void onReceive(final Context context, Intent intent) {
    //this will update the UI with message
    AlarmActivity inst = AlarmActivity.instance();
    inst.setAlarmText("Alarm! Wake up! Wake up!");

    //this will sound the alarm tone
    //this will sound the alarm once, if you wish to
    //raise alarm in loop continuously then use MediaPlayer and setLooping(true)
    Uri alarmUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
    if (alarmUri == null) {
        alarmUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    }
    Ringtone ringtone = RingtoneManager.getRingtone(context, alarmUri);
    ringtone.play();

    //this will send a notification message
    ComponentName comp = new ComponentName(context.getPackageName(),
            AlarmService.class.getName());
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
}
</code></pre>

<p>}</p>

<p>The code is code that I downloaded as an example to work with from JavaPapers</p>

<p><a href="http://javapapers.com/android/android-alarm-clock-tutorial/" rel="nofollow">http://javapapers.com/android/android-alarm-clock-tutorial/</a></p>