Program: 160209
Project: 160209
Buggy source:
@Override public View getView(final int position,View convertView,ViewGroup parent){
  View item=convertView;
  View headerItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_header_layout,parent,false);
  TextView title=(TextView)headerItem.findViewById(R.id.lv_list_hdr);
  View styleItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_style,parent,false);
  CheckBox box=(CheckBox)styleItem.findViewById(R.id.checkBox1);
  View githubItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_github,parent,false);
  TextView githublink=(TextView)githubItem.findViewById(R.id.textView1);
  View signerItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_signer,parent,false);
  View imageItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_image,parent,false);
  ImageView imagePreview=(ImageView)imageItem.findViewById(R.id.imageView1);
  TextView imageDesc=(TextView)imageItem.findViewById(R.id.imagetag);
switch (position) {
case 0:
    title.setText("String_Node_Str");
  return headerItem;
case 11:
title.setText("String_Node_Str");
return headerItem;
case 12:
box.setText(R.string.opacity);
box.setChecked(squareFragment.squareProgressBar.isOpacity());
box.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
squareFragment.squareProgressBar.setOpacity(isChecked);
}
}
);
return styleItem;
case 13:
title.setText("String_Node_Str");
return headerItem;
case 14:
imagePreview.setImageResource(R.drawable.city);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.city);
}
}
);
return imageItem;
case 15:
imagePreview.setImageResource(R.drawable.millennium_stadium);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.millennium_stadium);
}
}
);
return imageItem;
case 16:
imagePreview.setImageResource(R.drawable.edinburgh);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.edinburgh);
}
}
);
return imageItem;
case 17:
imagePreview.setImageResource(R.drawable.holyroodpark);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.holyroodpark);
}
}
);
return imageItem;
case 18:
title.setText("String_Node_Str");
return headerItem;
case 19:
String text="String_Node_Str";
githublink.setText(Html.fromHtml(text));
githubItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View arg0){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str"));
startActivity(browserIntent);
}
}
);
return githubItem;
case 20:
signerItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View arg0){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str"));
startActivity(browserIntent);
}
}
);
return signerItem;
default :
break;
}
ArrayList<Integer> colourArray=new ArrayList<Integer>();
colourArray.add(color.holo_blue_bright);
colourArray.add(color.holo_blue_dark);
colourArray.add(color.holo_blue_light);
colourArray.add(color.holo_green_dark);
colourArray.add(color.holo_green_light);
colourArray.add(color.holo_orange_dark);
colourArray.add(color.holo_orange_light);
colourArray.add(color.holo_purple);
colourArray.add(color.holo_red_dark);
colourArray.add(color.holo_red_light);
if (position <= 10) {
Context context=getApplicationContext();
item=LayoutInflater.from(context).inflate(R.layout.lv_colour,parent,false);
View colourView=item.findViewById(R.id.colour_preview);
final Integer integer=colourArray.get(position - 1);
colourView.setBackgroundColor(context.getResources().getColor(integer));
item.setOnClickListener(new OnClickListener(){
@Override public void onClick(View arg0){
squareFragment.squareProgressBar.setHoloColor(integer);
selectItem(position);
}
}
);
TextView textView=(TextView)item.findViewById(R.id.colour_name);
textView.setText(getName(position - 1));
}
return item;
}

Fixed version (ground truth):
@Override public View getView(final int position,View convertView,ViewGroup parent){
  View item=convertView;
  View headerItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_header_layout,parent,false);
  TextView title=(TextView)headerItem.findViewById(R.id.lv_list_hdr);
  View styleItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_style,parent,false);
  CheckBox box=(CheckBox)styleItem.findViewById(R.id.checkBox1);
  View githubItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_github,parent,false);
  TextView githublink=(TextView)githubItem.findViewById(R.id.textView1);
  View signerItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_signer,parent,false);
  View imageItem=LayoutInflater.from(getApplicationContext()).inflate(R.layout.lv_image,parent,false);
  ImageView imagePreview=(ImageView)imageItem.findViewById(R.id.imageView1);
  TextView imageDesc=(TextView)imageItem.findViewById(R.id.imagetag);
switch (position) {
case 0:
    title.setText("String_Node_Str");
  return headerItem;
case 11:
title.setText("String_Node_Str");
return headerItem;
case 12:
box.setText(R.string.opacity);
box.setChecked(squareFragment.squareProgressBar.isOpacity());
box.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
squareFragment.squareProgressBar.setOpacity(isChecked);
}
}
);
return styleItem;
case 13:
title.setText("String_Node_Str");
return headerItem;
case 14:
imagePreview.setImageResource(R.drawable.city);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.city);
}
}
);
return imageItem;
case 15:
imagePreview.setImageResource(R.drawable.millennium_stadium);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.millennium_stadium);
}
}
);
return imageItem;
case 16:
imagePreview.setImageResource(R.drawable.edinburgh);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.edinburgh);
}
}
);
return imageItem;
case 17:
imagePreview.setImageResource(R.drawable.holyroodpark);
imageDesc.setText("String_Node_Str");
imageItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View v){
squareFragment.squareProgressBar.setImage(R.drawable.holyroodpark);
}
}
);
return imageItem;
case 18:
title.setText("String_Node_Str");
return headerItem;
case 19:
String text="String_Node_Str";
githublink.setText(Html.fromHtml(text));
githubItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View arg0){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str"));
startActivity(browserIntent);
}
}
);
return githubItem;
case 20:
signerItem.setOnClickListener(new OnClickListener(){
@Override public void onClick(View arg0){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str"));
startActivity(browserIntent);
}
}
);
return signerItem;
default :
break;
}
ArrayList<Integer> colourArray=new ArrayList<Integer>();
colourArray.add(color.holo_blue_bright);
colourArray.add(color.holo_blue_dark);
colourArray.add(color.holo_blue_light);
colourArray.add(color.holo_green_dark);
colourArray.add(color.holo_green_light);
colourArray.add(color.holo_orange_dark);
colourArray.add(color.holo_orange_light);
colourArray.add(color.holo_purple);
colourArray.add(color.holo_red_dark);
colourArray.add(color.holo_red_light);
if (position <= 10) {
Context context=getApplicationContext();
item=LayoutInflater.from(context).inflate(R.layout.lv_colour,parent,false);
View colourView=item.findViewById(R.id.colour_preview);
final Integer integer=colourArray.get(position - 1);
colourView.setBackgroundColor(context.getResources().getColor(integer));
item.setOnClickListener(new OnClickListener(){
@Override public void onClick(View arg0){
squareFragment.squareProgressBar.setHoloColor(integer);
selectItem(position);
lastPosition=position;
}
}
);
TextView textView=(TextView)item.findViewById(R.id.colour_name);
textView.setText(getName(position - 1));
}
return item;
}