Program: 31771
Project: 31771
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View v,int position,long id){
  String selectedItemTag=v.getTag().toString();
  if (selectedItemTag.equals("String_Node_Str")) {
    return;
  }
  String selectedItemText=((TextView)v).getText().toString();
  int buttonId=Integer.parseInt((parent.getTag().toString()));
  Button buttonView=(Button)findViewById(buttonId);
  buttonView.setText(selectedItemText);
  boolean b_need_restart_audio;
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(this);
  SharedPreferences.Editor editor=sharedPref.edit();
switch (buttonId) {
case R.id.button_sample_rate:
    analyzerViews.popupMenuSampleRate.dismiss();
  if (!isLockViewRange) {
    viewRangeArray=analyzerViews.graphView.getViewPhysicalRange();
    if (viewRangeArray[0] == viewRangeArray[6]) {
      viewRangeArray[0]=0;
    }
    if (viewRangeArray[1] == viewRangeArray[6 + 1]) {
      viewRangeArray[1]=Integer.parseInt(selectedItemTag) / 2;
    }
    Log.i(TAG,"String_Node_Str" + viewRangeArray[0] + "String_Node_Str"+ viewRangeArray[1]);
  }
analyzerParam.sampleRate=Integer.parseInt(selectedItemTag);
b_need_restart_audio=true;
editor.putInt("String_Node_Str",analyzerParam.sampleRate);
break;
case R.id.button_fftlen:
analyzerViews.popupMenuFFTLen.dismiss();
analyzerParam.fftLen=Integer.parseInt(selectedItemTag);
b_need_restart_audio=true;
editor.putInt("String_Node_Str",analyzerParam.fftLen);
break;
case R.id.button_average:
analyzerViews.popupMenuAverage.dismiss();
analyzerParam.nFFTAverage=Integer.parseInt(selectedItemTag);
if (analyzerViews.graphView != null) {
analyzerViews.graphView.setTimeMultiplier(analyzerParam.nFFTAverage);
}
b_need_restart_audio=false;
editor.putInt("String_Node_Str",analyzerParam.nFFTAverage);
break;
default :
Log.w(TAG,"String_Node_Str");
b_need_restart_audio=false;
}
editor.apply();
if (b_need_restart_audio) {
restartSampling(analyzerParam);
}
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View v,int position,long id){
  String selectedItemTag=v.getTag().toString();
  if (selectedItemTag.equals("String_Node_Str")) {
    return;
  }
  String selectedItemText=((TextView)v).getText().toString();
  int buttonId=Integer.parseInt((parent.getTag().toString()));
  Button buttonView=(Button)findViewById(buttonId);
  buttonView.setText(selectedItemText);
  boolean b_need_restart_audio;
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(this);
  SharedPreferences.Editor editor=sharedPref.edit();
switch (buttonId) {
case R.id.button_sample_rate:
    analyzerViews.popupMenuSampleRate.dismiss();
  if (!isLockViewRange) {
    viewRangeArray=analyzerViews.graphView.getViewPhysicalRange();
    if (viewRangeArray[0] == viewRangeArray[6]) {
      viewRangeArray[0]=0;
    }
    if (viewRangeArray[1] == viewRangeArray[6 + 1]) {
      viewRangeArray[1]=Integer.parseInt(selectedItemTag) / 2;
    }
    Log.i(TAG,"String_Node_Str" + viewRangeArray[0] + "String_Node_Str"+ viewRangeArray[1]);
  }
analyzerParam.sampleRate=Integer.parseInt(selectedItemTag);
b_need_restart_audio=true;
editor.putInt("String_Node_Str",analyzerParam.sampleRate);
break;
case R.id.button_fftlen:
analyzerViews.popupMenuFFTLen.dismiss();
analyzerParam.fftLen=Integer.parseInt(selectedItemTag);
b_need_restart_audio=true;
editor.putInt("String_Node_Str",analyzerParam.fftLen);
break;
case R.id.button_average:
analyzerViews.popupMenuAverage.dismiss();
analyzerParam.nFFTAverage=Integer.parseInt(selectedItemTag);
if (analyzerViews.graphView != null) {
analyzerViews.graphView.setTimeMultiplier(analyzerParam.nFFTAverage);
}
b_need_restart_audio=false;
editor.putInt("String_Node_Str",analyzerParam.nFFTAverage);
break;
default :
Log.w(TAG,"String_Node_Str");
b_need_restart_audio=false;
}
editor.commit();
if (b_need_restart_audio) {
restartSampling(analyzerParam);
}
}