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;
      }
    }
  }