In your layout, instead using adding a NumberPicker
like you normally would:
<NumberPicker android:id="@+id/numberpicker1" ... />
You would use a tag that points to your custom class.
<your.path.to.MyNumberPicker android:id="@+id/numberpicker1" ... />
So, if you added this to your activity_main
layout, you could initialize it using View.findViewById
:
setContentView(R.layout.activity_main);
final MyNumberPicker np = (MyNumberPicker) findViewById(R.id.numberpicker1);