<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="7" />
if you want to cast to your cusmo ViewPager you should change the xml to
<com.yourpackage.HackyViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="7" />
you missed to declare the following constructor
public HackyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}