@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    DataMonitoring dataMonitoring = null;
    if (resultCode == RESULT_OK) {
      Bundle bundle = data.getExtras();
      dataMonitoring = EntityBundleMaker.getDataMonitoringFromBundle(bundle);
      dataMonitoring =
          databaseManager.getDataMonitoringByIdMonitoring(
              dataMonitoring.getIdMonitoring(), false, false);
      switch (requestCode) {
        case Operation.ADD:
          {
            break;
          }
        case Operation.EDIT:
          {
            for (DataMonitoring forDataMonitoring : dataMonitorings) {
              if (forDataMonitoring.getIdMonitoring().equals(dataMonitoring.getIdMonitoring())) {
                dataMonitorings.remove(forDataMonitoring);
                break;
              }
            }
            break;
          }
      }

      dataMonitorings.add(dataMonitoring);
      daftarMonitoringAdapter.notifyDataSetChanged();
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_monak);
    Intent intent = getIntent();
    final Bundle bundle = intent.getExtras();
    anak = EntityBundleMaker.getAnakFromBundle(bundle);
    databaseManager = new DatabaseManagerOrtu(this);
    if (anak == null) {
      dataMonitorings = databaseManager.getAllDataMonitorings(true, true);
      if (dataMonitorings != null && dataMonitorings.size() > 0) {
        anak = dataMonitorings.get(0).getAnak();
      }
      justView = true;
    } else {
      dataMonitorings = databaseManager.getDataMonitoringsByAnak(anak.getIdAnak());
    }
    if (dataMonitorings == null) {
      dataMonitorings = new ArrayList<DataMonitoring>();
    }
    daftarMonitoringAdapter =
        new AdapterDaftarMonitoring(this, R.layout.daftar_monitoring_item, dataMonitorings);

    ImageView ivAdd = (ImageView) findViewById(R.id.listMonakIvAdd);
    ivAdd.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View arg0) {
            onAdd(bundle);
          }
        });

    ImageView ivMap = (ImageView) findViewById(R.id.listMonakMap);
    ivMap.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Intent intent = new Intent(DaftarMonitoring.this, Peta.class);
            startActivity(intent);
            finish();
          }
        });

    if (justView) {
      ivAdd.setVisibility(View.GONE);
      ivMap.setVisibility(View.GONE);
    }

    getListView().setAdapter(daftarMonitoringAdapter);
  }
  public void deleteSave(Bundle bundle) {
    DataMonitoring dataMonitoring = EntityBundleMaker.getDataMonitoringFromBundle(bundle);

    dataMonitoring =
        databaseManager.getDataMonitoringByIdMonitoring(
            dataMonitoring.getIdMonitoring(), true, true);
    if (dataMonitoring == null) {
      return;
    }
    databaseManager.deleteDataMonitoring(dataMonitoring);
    for (DataMonitoring dataMonitoringFor : dataMonitorings) {
      if (dataMonitoringFor.getIdMonitoring().equals(dataMonitoring.getIdMonitoring())) {
        dataMonitorings.remove(dataMonitoringFor);
        break;
      }
    }
    daftarMonitoringAdapter.notifyDataSetChanged();
  }