Program: 88761
Project: 88761
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ep=getSharedPreferences("String_Node_Str",0);
  String local=ep.getString("String_Node_Str","String_Node_Str");
  String region=ep.getString("String_Node_Str","String_Node_Str");
  Locale locale2=new Locale(local,region);
  Locale.setDefault(locale2);
  Configuration config2=new Configuration();
  config2.locale=locale2;
  getBaseContext().getResources().updateConfiguration(config2,getBaseContext().getResources().getDisplayMetrics());
  setContentView(R.layout.draglist);
  if (getActionBar() != null) {
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
  }
  thisActivity=this;
  final String[] data=new String[10];
  final String[] enData=new String[10];
  data[0]=getString(R.string.numeric);
  data[1]=getString(R.string.qualitative);
  data[2]=getString(R.string.date);
  data[3]=getString(R.string.percent);
  data[4]=getString(R.string.bool);
  data[5]=getString(R.string.text);
  data[6]=getString(R.string.photo);
  data[7]=getString(R.string.audio);
  data[8]=getString(R.string.counter);
  data[9]=getString(R.string.rustrating);
  enData[0]="String_Node_Str";
  enData[1]="String_Node_Str";
  enData[2]="String_Node_Str";
  enData[3]="String_Node_Str";
  enData[4]="String_Node_Str";
  enData[5]="String_Node_Str";
  enData[6]="String_Node_Str";
  enData[7]="String_Node_Str";
  enData[8]="String_Node_Str";
  enData[9]="String_Node_Str";
  traitList=(DragSortListView)findViewById(R.id.myList);
  traitList.setDropListener(new DropListener(){
    @Override public void drop(    int from,    int to){
      if (to > from) {
        Log.w("String_Node_Str","String_Node_Str");
        try {
          String prevID=mAdapter.getItem(from).id;
          String prevPosition=mAdapter.getItem(from).realPosition;
          String currentID=mAdapter.getItem(to).id;
          String currentPosition=mAdapter.getItem(to).realPosition;
          MainActivity.dt.updateTraitPosition(currentID,currentPosition);
          MainActivity.dt.updateTraitPosition(prevID,String.valueOf(Integer.parseInt(currentPosition) + 1));
          int newCount=2;
          for (int i=to + 1; i < mAdapter.getCount(); i++) {
            MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(Integer.parseInt(currentPosition) + newCount));
            newCount++;
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
 else {
        Log.w("String_Node_Str","String_Node_Str");
        try {
          String prevID=mAdapter.getItem(from).id;
          String prevPosition=mAdapter.getItem(from).realPosition;
          String currentID=mAdapter.getItem(to).id;
          String currentPosition=mAdapter.getItem(to).realPosition;
          if (Integer.parseInt(currentPosition) - to >= 0) {
            Log.w("String_Node_Str","String_Node_Str");
            int newCount=Integer.parseInt(currentPosition) - to;
            for (int i=0; i < to; i++) {
              MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(newCount));
              Log.w(mAdapter.getItem(i).trait,String.valueOf(newCount));
              newCount++;
            }
            Log.w("String_Node_Str","String_Node_Str");
            MainActivity.dt.updateTraitPosition(prevID,currentPosition);
            Log.w(mAdapter.getItem(from).trait,currentPosition);
          }
 else {
            Log.w("String_Node_Str","String_Node_Str");
            for (int i=0; i < to; i++) {
              MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(i));
              Log.w(mAdapter.getItem(i).trait,String.valueOf(i));
            }
            Log.w("String_Node_Str","String_Node_Str");
            MainActivity.dt.updateTraitPosition(prevID,String.valueOf(to));
            Log.w(mAdapter.getItem(from).trait,String.valueOf(to));
            currentPosition=String.valueOf(to);
          }
          Log.w("String_Node_Str","String_Node_Str");
          int newCount=1;
          for (int i=to; i < mAdapter.getCount(); i++) {
            if (i != from) {
              MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(Integer.parseInt(currentPosition) + newCount));
              Log.w(mAdapter.getItem(i).trait,String.valueOf(Integer.parseInt(currentPosition) + newCount));
              newCount++;
            }
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
      loadData();
    }
  }
);
  createDialog=new Dialog(this,android.R.style.Theme_Holo_Light_Dialog);
  createDialog.setContentView(R.layout.trait);
  createDialog.setTitle(getString(R.string.addtrait));
  createDialog.setCancelable(true);
  createDialog.setCanceledOnTouchOutside(true);
  android.view.WindowManager.LayoutParams params=createDialog.getWindow().getAttributes();
  params.width=LayoutParams.MATCH_PARENT;
  createDialog.getWindow().setAttributes(params);
  createDialog.setOnCancelListener(new OnCancelListener(){
    public void onCancel(    DialogInterface arg0){
      createVisible=false;
    }
  }
);
  createDialog.setOnDismissListener(new OnDismissListener(){
    public void onDismiss(    DialogInterface arg0){
      createVisible=false;
    }
  }
);
  trait=(EditText)createDialog.findViewById(R.id.trait);
  format=(Spinner)createDialog.findViewById(R.id.format);
  def=(EditText)createDialog.findViewById(R.id.def);
  minimum=(EditText)createDialog.findViewById(R.id.minimum);
  maximum=(EditText)createDialog.findViewById(R.id.maximum);
  details=(EditText)createDialog.findViewById(R.id.details);
  categories=(EditText)createDialog.findViewById(R.id.categories);
  defBox=(LinearLayout)createDialog.findViewById(R.id.defbox);
  minBox=(LinearLayout)createDialog.findViewById(R.id.minbox);
  maxBox=(LinearLayout)createDialog.findViewById(R.id.maxbox);
  categoryBox=(LinearLayout)createDialog.findViewById(R.id.categorybox);
  bool=(ToggleButton)createDialog.findViewById(R.id.boolBtn);
  defTv=(TextView)createDialog.findViewById(R.id.defTv);
  Button saveBtn=(Button)createDialog.findViewById(R.id.saveBtn);
  Button closeBtn=(Button)createDialog.findViewById(R.id.closeBtn);
  trait.isFocused();
  traitListener=new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      o=mAdapter.getItem(position);
      currentId=o.id;
      trait.setText(o.trait);
      oldTrait=o.trait;
      for (int i=0; i < data.length; i++) {
        if (data[i].toLowerCase().equals(o.format.toLowerCase())) {
          currentPosition=i;
          format.setSelection(i,true);
          prepareFields(i);
          break;
        }
      }
      def.setText(o.defaultValue);
      if (o.defaultValue.equals("String_Node_Str"))       bool.setChecked(true);
 else       bool.setChecked(false);
      minimum.setText(o.minimum);
      maximum.setText(o.maximum);
      details.setText(o.details);
      categories.setText(o.categories);
      edit=true;
      createVisible=true;
      loadData();
      createDialog.show();
    }
  }
;
  format.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> av,    View arg1,    int position,    long arg3){
      if (position != currentPosition) {
        def.setText("String_Node_Str");
        minimum.setText("String_Node_Str");
        maximum.setText("String_Node_Str");
        details.setText("String_Node_Str");
        categories.setText("String_Node_Str");
        bool.setChecked(false);
        currentPosition=position;
        format.setSelection(currentPosition);
        prepareFields(currentPosition);
      }
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  ArrayAdapter<String> itemsAdapter=new ArrayAdapter<String>(this,R.layout.spinnerlayout,data);
  format.setAdapter(itemsAdapter);
  closeBtn.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      if (dataChanged()) {
        AlertDialog.Builder builder=new AlertDialog.Builder(TraitEditorActivity.this);
        builder.setTitle(getString(R.string.close));
        builder.setMessage(getString(R.string.areyousure));
        builder.setPositiveButton(getString(R.string.yes),new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int which){
            dialog.dismiss();
            createDialog.dismiss();
          }
        }
);
        builder.setNegativeButton(getString(R.string.no),new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int which){
            dialog.dismiss();
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
 else {
        createDialog.dismiss();
      }
    }
  }
);
  saveBtn.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      if (trait.getText().toString().length() == 0) {
        Toast.makeText(TraitEditorActivity.this,getString(R.string.mandatorytrait),Toast.LENGTH_LONG).show();
        return;
      }
      boolean exists=MainActivity.dt.hasTrait(trait.getText().toString().trim());
      if (!edit) {
        if (exists) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.traitexists),Toast.LENGTH_LONG).show();
          return;
        }
      }
 else {
        if (exists & !oldTrait.toLowerCase().equals(trait.getText().toString().trim().toLowerCase())) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.traitexists),Toast.LENGTH_LONG).show();
          return;
        }
      }
      if (format.getSelectedItemPosition() == 0) {
        if (def.getText().toString().length() > 0 & !isNumeric(def.getText().toString(),false)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (minimum.getText().toString().length() > 0 & !isNumeric(minimum.getText().toString(),false)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (maximum.getText().toString().length() > 0 & !isNumeric(maximum.getText().toString(),false)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
      }
      if (format.getSelectedItemPosition() == 1) {
        if (categories.getText().toString().length() == 0) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notemptycategory),Toast.LENGTH_LONG).show();
          return;
        }
      }
      if (format.getSelectedItemPosition() == 3) {
        if (def.getText().toString().length() == 0 | !isNumeric(def.getText().toString(),true)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (minimum.getText().toString().length() == 0 | !isNumeric(minimum.getText().toString(),true)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (maximum.getText().toString().length() == 0 | !isNumeric(maximum.getText().toString(),true)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
      }
      int pos=MainActivity.dt.getMaxPositionFromTraits() + 1;
      if (format.getSelectedItemPosition() == 4) {
        if (bool.isChecked())         def.setText("String_Node_Str");
 else         def.setText("String_Node_Str");
      }
      if (!edit)       MainActivity.dt.insertTraits(trait.getText().toString().trim(),enData[format.getSelectedItemPosition()].toLowerCase(),def.getText().toString(),minimum.getText().toString(),maximum.getText().toString(),details.getText().toString(),categories.getText().toString(),"String_Node_Str",String.valueOf(pos));
 else       MainActivity.dt.editTraits(currentId,trait.getText().toString().trim(),format.getSelectedItem().toString().toLowerCase(),def.getText().toString(),minimum.getText().toString(),maximum.getText().toString(),details.getText().toString(),categories.getText().toString());
      Editor ed=ep.edit();
      ed.putBoolean("String_Node_Str",true);
      ed.apply();
      loadData();
      MainActivity.reloadData=true;
      createDialog.dismiss();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ep=getSharedPreferences("String_Node_Str",0);
  String local=ep.getString("String_Node_Str","String_Node_Str");
  String region=ep.getString("String_Node_Str","String_Node_Str");
  Locale locale2=new Locale(local,region);
  Locale.setDefault(locale2);
  Configuration config2=new Configuration();
  config2.locale=locale2;
  getBaseContext().getResources().updateConfiguration(config2,getBaseContext().getResources().getDisplayMetrics());
  setContentView(R.layout.draglist);
  if (getActionBar() != null) {
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
  }
  thisActivity=this;
  final String[] data=new String[10];
  final String[] enData=new String[10];
  data[0]=getString(R.string.numeric);
  data[1]=getString(R.string.qualitative);
  data[2]=getString(R.string.date);
  data[3]=getString(R.string.percent);
  data[4]=getString(R.string.bool);
  data[5]=getString(R.string.text);
  data[6]=getString(R.string.photo);
  data[7]=getString(R.string.audio);
  data[8]=getString(R.string.counter);
  data[9]=getString(R.string.rustrating);
  enData[0]="String_Node_Str";
  enData[1]="String_Node_Str";
  enData[2]="String_Node_Str";
  enData[3]="String_Node_Str";
  enData[4]="String_Node_Str";
  enData[5]="String_Node_Str";
  enData[6]="String_Node_Str";
  enData[7]="String_Node_Str";
  enData[8]="String_Node_Str";
  enData[9]="String_Node_Str";
  traitList=(DragSortListView)findViewById(R.id.myList);
  traitList.setDropListener(new DropListener(){
    @Override public void drop(    int from,    int to){
      if (to > from) {
        Log.w("String_Node_Str","String_Node_Str");
        try {
          String prevID=mAdapter.getItem(from).id;
          String prevPosition=mAdapter.getItem(from).realPosition;
          String currentID=mAdapter.getItem(to).id;
          String currentPosition=mAdapter.getItem(to).realPosition;
          MainActivity.dt.updateTraitPosition(currentID,currentPosition);
          MainActivity.dt.updateTraitPosition(prevID,String.valueOf(Integer.parseInt(currentPosition) + 1));
          int newCount=2;
          for (int i=to + 1; i < mAdapter.getCount(); i++) {
            MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(Integer.parseInt(currentPosition) + newCount));
            newCount++;
          }
          MainActivity.reloadData=true;
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
 else {
        Log.w("String_Node_Str","String_Node_Str");
        try {
          String prevID=mAdapter.getItem(from).id;
          String prevPosition=mAdapter.getItem(from).realPosition;
          String currentID=mAdapter.getItem(to).id;
          String currentPosition=mAdapter.getItem(to).realPosition;
          if (Integer.parseInt(currentPosition) - to >= 0) {
            Log.w("String_Node_Str","String_Node_Str");
            int newCount=Integer.parseInt(currentPosition) - to;
            for (int i=0; i < to; i++) {
              MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(newCount));
              Log.w(mAdapter.getItem(i).trait,String.valueOf(newCount));
              newCount++;
            }
            Log.w("String_Node_Str","String_Node_Str");
            MainActivity.dt.updateTraitPosition(prevID,currentPosition);
            Log.w(mAdapter.getItem(from).trait,currentPosition);
          }
 else {
            Log.w("String_Node_Str","String_Node_Str");
            for (int i=0; i < to; i++) {
              MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(i));
              Log.w(mAdapter.getItem(i).trait,String.valueOf(i));
            }
            Log.w("String_Node_Str","String_Node_Str");
            MainActivity.dt.updateTraitPosition(prevID,String.valueOf(to));
            Log.w(mAdapter.getItem(from).trait,String.valueOf(to));
            currentPosition=String.valueOf(to);
          }
          Log.w("String_Node_Str","String_Node_Str");
          int newCount=1;
          for (int i=to; i < mAdapter.getCount(); i++) {
            if (i != from) {
              MainActivity.dt.updateTraitPosition(mAdapter.getItem(i).id,String.valueOf(Integer.parseInt(currentPosition) + newCount));
              Log.w(mAdapter.getItem(i).trait,String.valueOf(Integer.parseInt(currentPosition) + newCount));
              newCount++;
            }
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
      MainActivity.reloadData=true;
      loadData();
    }
  }
);
  createDialog=new Dialog(this,android.R.style.Theme_Holo_Light_Dialog);
  createDialog.setContentView(R.layout.trait);
  createDialog.setTitle(getString(R.string.addtrait));
  createDialog.setCancelable(true);
  createDialog.setCanceledOnTouchOutside(true);
  android.view.WindowManager.LayoutParams params=createDialog.getWindow().getAttributes();
  params.width=LayoutParams.MATCH_PARENT;
  createDialog.getWindow().setAttributes(params);
  createDialog.setOnCancelListener(new OnCancelListener(){
    public void onCancel(    DialogInterface arg0){
      createVisible=false;
    }
  }
);
  createDialog.setOnDismissListener(new OnDismissListener(){
    public void onDismiss(    DialogInterface arg0){
      createVisible=false;
    }
  }
);
  trait=(EditText)createDialog.findViewById(R.id.trait);
  format=(Spinner)createDialog.findViewById(R.id.format);
  def=(EditText)createDialog.findViewById(R.id.def);
  minimum=(EditText)createDialog.findViewById(R.id.minimum);
  maximum=(EditText)createDialog.findViewById(R.id.maximum);
  details=(EditText)createDialog.findViewById(R.id.details);
  categories=(EditText)createDialog.findViewById(R.id.categories);
  defBox=(LinearLayout)createDialog.findViewById(R.id.defbox);
  minBox=(LinearLayout)createDialog.findViewById(R.id.minbox);
  maxBox=(LinearLayout)createDialog.findViewById(R.id.maxbox);
  categoryBox=(LinearLayout)createDialog.findViewById(R.id.categorybox);
  bool=(ToggleButton)createDialog.findViewById(R.id.boolBtn);
  defTv=(TextView)createDialog.findViewById(R.id.defTv);
  Button saveBtn=(Button)createDialog.findViewById(R.id.saveBtn);
  Button closeBtn=(Button)createDialog.findViewById(R.id.closeBtn);
  trait.isFocused();
  traitListener=new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      o=mAdapter.getItem(position);
      currentId=o.id;
      trait.setText(o.trait);
      oldTrait=o.trait;
      for (int i=0; i < data.length; i++) {
        if (data[i].toLowerCase().equals(o.format.toLowerCase())) {
          currentPosition=i;
          format.setSelection(i,true);
          prepareFields(i);
          break;
        }
      }
      def.setText(o.defaultValue);
      if (o.defaultValue.equals("String_Node_Str"))       bool.setChecked(true);
 else       bool.setChecked(false);
      minimum.setText(o.minimum);
      maximum.setText(o.maximum);
      details.setText(o.details);
      categories.setText(o.categories);
      edit=true;
      createVisible=true;
      loadData();
      createDialog.show();
    }
  }
;
  format.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> av,    View arg1,    int position,    long arg3){
      if (position != currentPosition) {
        def.setText("String_Node_Str");
        minimum.setText("String_Node_Str");
        maximum.setText("String_Node_Str");
        details.setText("String_Node_Str");
        categories.setText("String_Node_Str");
        bool.setChecked(false);
        currentPosition=position;
        format.setSelection(currentPosition);
        prepareFields(currentPosition);
      }
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  ArrayAdapter<String> itemsAdapter=new ArrayAdapter<String>(this,R.layout.spinnerlayout,data);
  format.setAdapter(itemsAdapter);
  closeBtn.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      if (dataChanged()) {
        AlertDialog.Builder builder=new AlertDialog.Builder(TraitEditorActivity.this);
        builder.setTitle(getString(R.string.close));
        builder.setMessage(getString(R.string.areyousure));
        builder.setPositiveButton(getString(R.string.yes),new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int which){
            dialog.dismiss();
            createDialog.dismiss();
          }
        }
);
        builder.setNegativeButton(getString(R.string.no),new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int which){
            dialog.dismiss();
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
 else {
        createDialog.dismiss();
      }
    }
  }
);
  saveBtn.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      if (trait.getText().toString().length() == 0) {
        Toast.makeText(TraitEditorActivity.this,getString(R.string.mandatorytrait),Toast.LENGTH_LONG).show();
        return;
      }
      boolean exists=MainActivity.dt.hasTrait(trait.getText().toString().trim());
      if (!edit) {
        if (exists) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.traitexists),Toast.LENGTH_LONG).show();
          return;
        }
      }
 else {
        if (exists & !oldTrait.toLowerCase().equals(trait.getText().toString().trim().toLowerCase())) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.traitexists),Toast.LENGTH_LONG).show();
          return;
        }
      }
      if (format.getSelectedItemPosition() == 0) {
        if (def.getText().toString().length() > 0 & !isNumeric(def.getText().toString(),false)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (minimum.getText().toString().length() > 0 & !isNumeric(minimum.getText().toString(),false)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (maximum.getText().toString().length() > 0 & !isNumeric(maximum.getText().toString(),false)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
      }
      if (format.getSelectedItemPosition() == 1) {
        if (categories.getText().toString().length() == 0) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notemptycategory),Toast.LENGTH_LONG).show();
          return;
        }
      }
      if (format.getSelectedItemPosition() == 3) {
        if (def.getText().toString().length() == 0 | !isNumeric(def.getText().toString(),true)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (minimum.getText().toString().length() == 0 | !isNumeric(minimum.getText().toString(),true)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
        if (maximum.getText().toString().length() == 0 | !isNumeric(maximum.getText().toString(),true)) {
          Toast.makeText(TraitEditorActivity.this,getString(R.string.notanumber),Toast.LENGTH_LONG).show();
          return;
        }
      }
      int pos=MainActivity.dt.getMaxPositionFromTraits() + 1;
      if (format.getSelectedItemPosition() == 4) {
        if (bool.isChecked())         def.setText("String_Node_Str");
 else         def.setText("String_Node_Str");
      }
      if (!edit)       MainActivity.dt.insertTraits(trait.getText().toString().trim(),enData[format.getSelectedItemPosition()].toLowerCase(),def.getText().toString(),minimum.getText().toString(),maximum.getText().toString(),details.getText().toString(),categories.getText().toString(),"String_Node_Str",String.valueOf(pos));
 else       MainActivity.dt.editTraits(currentId,trait.getText().toString().trim(),format.getSelectedItem().toString().toLowerCase(),def.getText().toString(),minimum.getText().toString(),maximum.getText().toString(),details.getText().toString(),categories.getText().toString());
      Editor ed=ep.edit();
      ed.putBoolean("String_Node_Str",true);
      ed.apply();
      loadData();
      MainActivity.reloadData=true;
      createDialog.dismiss();
    }
  }
);
}