@Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.sensor_ok:
        setAcceptedFields();
        setResult(RESULT_OK);
        finish();
        break;

      case R.id.check_layout:
        CheckedTextView ctv = (CheckedTextView) v.findViewById(R.id.sensorlabel);
        if (ctv.isChecked()) ctv.setCheckMarkDrawable(R.drawable.red_x);
        else ctv.setCheckMarkDrawable(R.drawable.checkmark);
        ctv.toggle();
        break;
    }
  }
 // Check compatibility against SensorTypes
 void setCompatibility(TextView tv, CheckedTextView ctv, SensorTypes sensor) {
   if (sensors.isCompatible(sensor)) {
     tv.setTextColor(Color.parseColor("#00AA00"));
     tv.setText(R.string.compatible);
     ctv.setChecked(true);
   } else {
     tv.setTextColor(Color.parseColor("#AA0000"));
     tv.setText(R.string.incompatible);
     ctv.setChecked(false);
     ctv.setCheckMarkDrawable(R.drawable.red_x);
   }
 }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      final View itemView = super.getView(position, convertView, parent);

      // Hide the checkable drawable.  This assumes that the item views
      // are CheckedTextView objects
      final CheckedTextView checkedTextView = (CheckedTextView) itemView;
      if (!getItemIsCheckable(position)) {
        checkedTextView.setCheckMarkDrawable(null);
      }

      return checkedTextView;
    }