@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.trap_details);
    // info = MainActivity.appointmentInfo;
    Bundle b = getIntent().getExtras();
    if (b != null) {
      appointment_id = b.getInt(Const.Appointment_Id);
      cust_id = b.getInt("CUST_ID");
      barcode = b.getString("BARCODE");
      if (b.containsKey("isFromUnChecked")) {
        isFromUnChecked = b.getBoolean("isFromUnChecked");
      }
    }
    if (appointment_id == 0) {
      appointment_id = Const.app_id;
    }
    if (cust_id == 0) {
      cust_id = Const.customer_id;
    }
    if (barcode.length() == 0) {
      barcode = Const.BarCode;
    }
    action = getSupportActionBar();
    // action.setTitle("Traps Scan Details");
    action.setTitle(
        Html.fromHtml(
            "<font color='"
                + getString(R.string.header_text_color)
                + "'>Traps Scan Details</font>"));
    action.setHomeButtonEnabled(true);
    action.setDisplayHomeAsUpEnabled(true);

    lstMaterial = (ListView) findViewById(R.id.lstMaterialUsages);
    btnSaveTrapData = (Button) findViewById(R.id.btnSaveTrapData);
    btnClean = (Button) findViewById(R.id.btnClean);
    rlEvidence = (RelativeLayout) findViewById(R.id.rlEvidence);
    rlCaptured = (RelativeLayout) findViewById(R.id.rlCaptured);
    llContainer = (LinearLayout) findViewById(R.id.llContainer);
    rlMaterial = (RelativeLayout) findViewById(R.id.rlMaterialUsage);
    txtBarcode = (TextView) findViewById(R.id.txtBarcode);
    txtLocation = (TextView) findViewById(R.id.txtLocation);
    txtBuilding = (TextView) findViewById(R.id.txtBuilding);
    txtFloor = (TextView) findViewById(R.id.txtFloor);
    txtTrapType = (TextView) findViewById(R.id.txtTrapType);
    txtTrapNumber = (TextView) findViewById(R.id.txtNumber);
    txtMessage = (TextView) findViewById(R.id.txtMessage);
    imgClean = (ImageView) findViewById(R.id.imgClean);
    tgbRemoved = (ToggleButton) findViewById(R.id.tgbremoved);
    spnBaitCondition = (Spinner) findViewById(R.id.spnbait_condition_id);
    spnTrapCondition = (Spinner) findViewById(R.id.spntrap_condition_id);
    edtException = (EditText) findViewById(R.id.edtexception);
    txtExceptionCount = (TextView) findViewById(R.id.txtCount);
    btnSaveTrapData.setOnClickListener(this);
    btnClean.setOnClickListener(this);
    rlCaptured.setOnClickListener(this);
    rlEvidence.setOnClickListener(this);
    rlMaterial.setOnClickListener(this);
    trapscan_info = TrapList.Instance().getTrapByBarcodeNdCustomerId(barcode, cust_id);
    inspection = InspectionList.Instance().getInspectionByApp_Id(appointment_id, barcode);
    if (inspection == null) {
      isEdit = false;
      try {
        inspection = FieldworkApplication.Connection().newEntity(InspectionInfo.class);
        inspection.id = -1;
        inspection.barcode = barcode;
        inspection.save();
      } catch (ActiveRecordException e) {
        e.printStackTrace();
      }
    } else {
      isEdit = true;
      m_inspectionPests =
          InspectionPestsList.Instance().getInspectionPestByInspectionId(inspection.id);
      isClean = getIsClean(inspection, m_inspectionPests);
      isCleanInspection = getIsClean(inspection, m_inspectionPests);
      if (isClean) {
        imgClean.setVisibility(View.VISIBLE);
      }
    }
    LoadValues();
    LoadSpinners();
    if (isEdit) {
      loadMaterial();
    }
    tgbRemoved.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            isRemoved = isChecked;
          }
        });
  };
 public void gotoback() {
   hideProgress();
   TrapScanningInfo trap = TrapList.Instance().getTrapByBarcodeNdCustomerId(barcode, cust_id);
   trap.isChecked = true;
   finish();
 }