Set multiple alarms using sqlite database but only one alarm remaining <p>I set multiple alarms using SQLite, but when I set the clock, there is just one alarm that is the last one I set. How can I fix this?</p> <pre><code>public class alert extends Activity{ DatePicker pickerDate; TimePicker pickerTime; Button buttonSetAlarm; Button insertButton;`enter code here` TextView info; Context mContext; AlarmManager mAlarmManager; dalAlarm dbAlarm ; SQLiteOpenHelper dbHelper; SQLiteDatabase database; final static int RQS_1 = 0; dalAlarm dalAl = new dalAlarm(this); public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.alertscreen); info = (TextView)findViewById(R.id.info); pickerDate = (DatePicker)findViewById(R.id.pickerdate); pickerTime = (TimePicker)findViewById(R.id.pickertime); Calendar now = Calendar.getInstance(); pickerDate.init( now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH), null); pickerTime.setCurrentHour(now.get(Calendar.HOUR_OF_DAY)); pickerTime.setCurrentMinute(now.get(Calendar.MINUTE)); buttonSetAlarm = (Button)findViewById(R.id.setalarm); buttonSetAlarm.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { Calendar current = Calendar.getInstance(); Calendar cal = Calendar.getInstance(); cal.set(pickerDate.getYear(), pickerDate.getMonth(), pickerDate.getDayOfMonth(), pickerTime.getCurrentHour(), pickerTime.getCurrentMinute(), 00); //dbAlarm.addNewAlarm(new dalHelper_alarm(pickerTime.getCurrentHour(),pickerTime.getCurrentMinute(),cal.getTime().toString())); if(cal.compareTo(current) &lt;= 0){ Toast.makeText(getApplicationContext(), "Invalid Date/Time", Toast.LENGTH_LONG).show(); }else{ // dbAlarm.addNewAlarm(new dalHelper_alarm(pickerTime.getCurrentHour(),pickerTime.getCurrentMinute(),cal.getTime().toString())); setAlarm(cal); database(); } } }); } public void setAlarm(Calendar targetCal) { info.setText("\n\n***\n" + "Alarm is set@ " + targetCal.getTime() + "\n" + "***\n"); dalAlarm db = new dalAlarm(alert.this); dalHelper_alarm test = new dalHelper_alarm(pickerTime.getCurrentHour(),pickerTime.getCurrentMinute(),targetCal.getTime().toString()); db.addNewAlarm(test); } public void newAlarm(Calendar newCal){ Intent intent = new Intent(getBaseContext(), popUp.class); PendingIntent pendingIntent = PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, newCal.getTimeInMillis(), pendingIntent); } public void database(){ ArrayList&lt;dalHelper_alarm&gt; alarm = dalAl.getAllAlarm(); Calendar newCal = Calendar.getInstance(); newCal.set(pickerDate.getYear(), pickerDate.getMonth(), pickerDate.getDayOfMonth(), alarm.get(0).getHour(), alarm.get(0).getMin(), 00); info.setText("\n\n*** \n" + "Alarm is set@ " + newCal.getTime() + "\n" + "***\n"); newAlarm(newCal); } } </code></pre>