@Override
 public void onReceive(Context context, Intent intent) {
   if (intent != null && Event.LOAN_MODIFIED.name().equals(intent.getAction())) {
     Intent displayLoansIntent = new Intent(context, StandardLoansOverviewActivity.class);
     startActivity(displayLoansIntent);
   } else if (intent != null && Event.DELETE_LOAN.name().equals(intent.getAction())) {
     Intent displayLoansIntent = new Intent(context, LoansHistoryActivity.class);
     startActivity(displayLoansIntent);
   }
 }
  @Override
  protected void onResume() {
    super.onResume();

    if (dbFeedbackReceiver == null) {
      dbFeedbackReceiver = new DbFeedbackReceiver();
      intentFilter = new IntentFilter(Event.LOAN_MODIFIED.name());
      intentFilterForHistory = new IntentFilter(Event.DELETE_LOAN.name());
    }
    registerReceiver(dbFeedbackReceiver, intentFilter);
    registerReceiver(dbFeedbackReceiver, intentFilterForHistory);

    if (LoansHistoryActivity.class.getName().equals(callingActivity)) {
      this.setActionBarDelegate(new FilteredLoansHistoryActionBarDelegate());
    } else {
      setUpDisplay(new FilteredLoansOverviewActionBarDelegate());
    }

    handleClickEvent(callingActivity);
  }
  @Override
  protected void onResume() {
    super.onResume();

    if (dbFeedbackReceiver == null) {
      dbFeedbackReceiver = new DbFeedbackReceiver();
      intentFilter = new IntentFilter(Event.LOAN_MODIFIED.name());
      intentFilterForHistory = new IntentFilter(Event.DELETE_LOAN.name());
    }
    registerReceiver(dbFeedbackReceiver, intentFilter);
    registerReceiver(dbFeedbackReceiver, intentFilterForHistory);

    // To get the intent that is sent to the activity. The bundled passed as
    // parameter to onCreate() is the bundle
    // which the Activity uses when it is brought back from a paused state.
    // E.g. if you need to save any state of your
    // activity before it is restarted, this is the place where the stored
    // data is.
    Intent intent = getIntent();
    AbstractLoan loan = null;

    if (intent != null && Event.DISPLAY_LOAN_DETAIL.name().equals(intent.getAction())) {
      ViewHolder viewHolder = new ViewHolder();
      viewHolder.sourceAndDestination = (TextView) findViewById(R.id.loan_source);
      viewHolder.notificationDate = (TextView) findViewById(R.id.loan_reminder_date);
      viewHolder.creationDate = (TextView) findViewById(R.id.loan_creation_date);
      viewHolder.object = (TextView) findViewById(R.id.object_of_loan);

      loan = (AbstractLoan) intent.getExtras().getSerializable(Event.DISPLAY_LOAN_DETAIL.name());

      if (displayedLoan == null) {
        displayedLoan = loan;

        if (loan != null) {
          viewHolder.sourceAndDestination.setText(
              viewHolder.sourceAndDestination.getText() + loan.displayPerson() + " : ");
          if (loan.getNotificationDate() != null) {
            viewHolder.notificationDate.setText(
                viewHolder.notificationDate.getText()
                    + " "
                    + format.print(loan.getNotificationDate()));
          } else {
            viewHolder.notificationDate.setText("");
          }
          viewHolder.creationDate.setText(
              viewHolder.creationDate.getText() + " " + format.print(loan.getStartDate()));
          viewHolder.object.setText(viewHolder.object.getText() + " " + loan.displayDescription());
        }
      }
    }

    if (LoansHistoryActivity.class
        .getName()
        .equals(intent.getExtras().getSerializable("CALLING_ACTIVITY"))) {
      this.setActionBarDelegate(new DisplayHistoryDetailActionBarDelegate());
    }

    if (Boolean.TRUE.equals(intent.getExtras().get(Event.REMOVE_NOTIFICATION.name()))) {

      // remove notification from notification bar
      android.app.NotificationManager mNotificationManager =
          (android.app.NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
      mNotificationManager.cancel((int) loan.getId());
    }
  }