Program: 175616
Project: 175616
Buggy source:
public void init(Context context,AttributeSet attrs){
  this.context=context;
  this.attrs=attrs;
  int[] attrsArray=new int[]{R.attr.background_selected_color,R.attr.background_normal_color,R.attr.text_normal_color,R.attr.text_selected_color,R.attr.text_normal_size,R.attr.text_selected_size,R.attr.text_left,R.attr.text_right};
  TypedArray ta=context.obtainStyledAttributes(attrs,attrsArray);
  colorStateSelected=ta.getColor(0,getResources().getColor(R.color.background_selected_color));
  colorStateUnSelected=ta.getColor(1,getResources().getColor(R.color.background_normal_color));
  backgroundColor=colorStateUnSelected;
  text_normal_color=ta.getColor(2,getResources().getColor(R.color.text_normal_color));
  text_selected_color=ta.getColor(3,getResources().getColor(R.color.text_selected_color));
  text_normal_size=ta.getDimensionPixelSize(4,(int)getResources().getDimension(R.dimen.text_normal_size));
  text_selected_size=ta.getDimensionPixelSize(5,(int)getResources().getDimension(R.dimen.text_selected_size));
  lessText=ta.getString(6);
  if (lessText == null) {
    lessText=getResources().getString(R.string.text_left);
  }
  moreText=ta.getString(7);
  if (moreText == null) {
    moreText=getResources().getString(R.string.text_right);
  }
  ta.recycle();
  ovalPaint=new Paint();
  ovalPaint.setColor(backgroundColor);
  ovalPaint.setAntiAlias(true);
  thumbIcon=BitmapFactory.decodeResource(context.getResources(),R.drawable.switch_circle);
  orginalBitmapRect=new Rect();
  drawnBitmapRect=new Rect();
  ovalRectF=new RectF();
  textBounds=new Rect();
  textSelectedPaint=new Paint();
  textSelectedPaint.setColor(text_selected_color);
  textSelectedPaint.setTextSize(text_selected_size);
  textSelectedPaint.setAntiAlias(true);
  textNormalPaint=new Paint();
  textNormalPaint.setColor(text_normal_color);
  textNormalPaint.setTextSize(text_normal_size);
  textNormalPaint.setAntiAlias(true);
}

Fixed version (ground truth):
public void init(Context context,AttributeSet attrs){
  this.context=context;
  this.attrs=attrs;
  TypedArray ta=context.obtainStyledAttributes(attrs,R.styleable.ThreeStateSwitch);
  colorStateSelected=ta.getColor(R.styleable.ThreeStateSwitch_background_selected_color,getResources().getColor(R.color.background_selected_color));
  colorStateUnSelected=ta.getColor(R.styleable.ThreeStateSwitch_background_normal_color,getResources().getColor(R.color.background_normal_color));
  backgroundColor=colorStateUnSelected;
  text_normal_color=ta.getColor(R.styleable.ThreeStateSwitch_text_normal_color,getResources().getColor(R.color.text_normal_color));
  text_selected_color=ta.getColor(R.styleable.ThreeStateSwitch_text_selected_color,getResources().getColor(R.color.text_selected_color));
  text_normal_size=ta.getDimensionPixelSize(R.styleable.ThreeStateSwitch_text_normal_size,(int)getResources().getDimension(R.dimen.text_normal_size));
  text_selected_size=ta.getDimensionPixelSize(R.styleable.ThreeStateSwitch_text_selected_size,(int)getResources().getDimension(R.dimen.text_selected_size));
  lessText=ta.getString(R.styleable.ThreeStateSwitch_text_left);
  if (lessText == null) {
    lessText=getResources().getString(R.string.text_left);
  }
  moreText=ta.getString(R.styleable.ThreeStateSwitch_text_right);
  if (moreText == null) {
    moreText=getResources().getString(R.string.text_right);
  }
  ta.recycle();
  ovalPaint=new Paint();
  ovalPaint.setColor(backgroundColor);
  ovalPaint.setAntiAlias(true);
  thumbIcon=BitmapFactory.decodeResource(context.getResources(),R.drawable.switch_circle);
  orginalBitmapRect=new Rect();
  drawnBitmapRect=new Rect();
  ovalRectF=new RectF();
  textBounds=new Rect();
  textSelectedPaint=new Paint();
  textSelectedPaint.setColor(text_selected_color);
  textSelectedPaint.setTextSize(text_selected_size);
  textSelectedPaint.setAntiAlias(true);
  textNormalPaint=new Paint();
  textNormalPaint.setColor(text_normal_color);
  textNormalPaint.setTextSize(text_normal_size);
  textNormalPaint.setAntiAlias(true);
}