Custom Android pin code entry widget
It seems like you might be trying to create an iOS like pin entry view/widget.
Here is a good sample code you may find useful. However, it is fix length, but still maybe useful to some people.
https://github.com/chinloong/Android-PinView
http://madeveloper.blogspot.com/2013/02/android-ios-like-pin-entrychallenge.html
I know this has already been answered but since its implementation is not shared i found a similar open source library. It looks good and for all those who wandering can give it try
https://github.com/Philio/PinEntryView