code: private void addDots(int length) {
          removeAllViews();
          final int pinLength = styledAttributes.getInt(R.styleable.PinLock_pinLength, 4);
          for (int i = 0; i < pinLength; i++) {
              Dot dot = new Dot(context, styledAttributes, i < length);
              addView(dot);
          }
      }
docs: Adding Dot objects to layout
  @param length Length of PIN entered so far