I have extend Viewpage class but the problem is I always get java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pindak.sarito/com.pindak.sarito.ui.ws.MagazineReaderActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class com.pindak.sarito.util.HackyViewPager. When trying to inflate it.
this is my layout
<?xml version="1.0" encoding="utf-8"?>
<com.pindak.sarito.util.HackyViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/magazinepager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
this is the some of the code of my onCreate in activity
HackyViewPager pager = (HackyViewPager) findViewById(R.id.magazinepager);
and In com.pindak.sarito.util I have HackyViewPager.java
package com.pindak.sarito.util;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.view.MotionEvent;
public class HackyViewPager extends ViewPager {
public HackyViewPager(Context context) {
super(context);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
try {
return super.onInterceptTouchEvent(ev);
} catch (IllegalArgumentException e) {
e.printStackTrace();
return false;
}
}
}
Any Ideas Why I am getting this error?