public void removeNotification(int groupPosition) {
   SimpleNotification n = notifications.get(groupPosition);
   notifications.remove(n);
   adapter.notifyDataSetChanged();
   Context context = getApplicationContext();
   new NotificationsAlarmManager(context).removeAlarm(context, n);
 }
 public void editNotification(int location) {
   SimpleNotification n = notifications.get(location);
   Context context = getApplicationContext();
   Intent i = new Intent(context, CreateSimpleNotificationActivity.class);
   i.putExtra(CreateSimpleNotificationActivity.FLAG, CreateSimpleNotificationActivity.EDIT);
   i.putExtra(CreateSimpleNotificationActivity.EDITING_NOTIFICATION, n);
   i.putExtra(CreateSimpleNotificationActivity.ID, n.getId());
   startActivityForResult(i, REQUEST_CODE_EDIT);
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
      SimpleNotification notification = createNotificationFromIntent(data);
      Context context = getApplicationContext();
      switch (requestCode) {
        case REQUEST_CODE_EDIT:
          notifications.removeById(notification.getId());
          new NotificationsAlarmManager(context).removeAlarm(context, notification);

        case REQUEST_CODE_ADD:
          new NotificationsAlarmManager(context).setAlarm(context, notification);
          notifications.add(notification);
          adapter.notifyDataSetChanged();
          break;

        default:
          break;
      }
    }
  }
 private void configureList() {
   Context context = getApplicationContext();
   List<SimpleNotification> notificationsList = notifications.getAll();
   adapter = new NotificationsListAdaper(notificationsList, context, this);
   expListView.setAdapter(adapter);
 }