Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - How to set Multiple alarms using AlarmManager

How to set Multiple alarms using AlarmManager

Put your problem here if it does not fit any of the other categories.

How to set Multiple alarms using AlarmManager

Postby modha_chintan » Mon Nov 17, 2008 8:20 am

Hi I trying to add multiple alarms via alarm manager

but it seems that i can only set one.

can any one help me out with this .

following is my code...............

package com.cs380.popup;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Calendar;


public class test extends Activity {
/** Called when the activity is first created. */
private Toast mToast;
private TextView tv;
@Override


public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tv = new TextView(this);
tv.setText("Testing code");
setContentView(tv);
popup();
}

public void popup()
{
Intent intent = new Intent(test.this, OneShotAlaram.class);
PendingIntent sender = PendingIntent.getBroadcast(test.this,0, intent, 0);
PendingIntent sender2 = PendingIntent.getBroadcast(test.this,0, intent, 0);

Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 10);
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 5); // previous alarm (10 sec delay) gets disabled...
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender2);
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(test.this, "Test in progress wait 10 sec", Toast.LENGTH_LONG);
mToast.show();


}}
modha_chintan
Freshman
Freshman
 
Posts: 3
Joined: Mon Nov 17, 2008 8:09 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 10 guests