I am trying to use a PageAdapter. I found out that public Object instantiateItem( View pager, int position ) has been deprecated. So I am trying up update but ran into a problem. The new definition changes the deceration to public Object instantiateItem( ViewPager pager, int position ), when I do this and push it to my device the app crashed.
Here is my logcat output.
12-26 19:24:30.701: ERROR/AndroidRuntime(25431): FATAL EXCEPTION: main
java.lang.UnsupportedOperationException: Required method instantiateItem was not overridden
at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:175)
at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:649)
at android.support.v4.view.ViewPager.populate(ViewPager.java:783)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1016)
So I added @Override to the method call, but when I compile it ,using maven, I get the following output that corresponds to my method.
Chronos/ChronosApp/src/com/kopysoft/chronos/view/ClockViewer.java:[67,4] error: method does not override or implement a method from a supertype
I am at a lose as what to do. Any advice would be greatly appreciated!
The entire code can be found here: http://pastebin.com/da5Kqcmg
The runtime code in PagerAdapter.instantiateItem() is throwing the exception because it wants you to override that. So make sure you are overriding the method that is throwing the exception. You probably just want to switch your code back to overriding the deprecated method since that’s what your runtime library is expecting.
Might it be possible that you have an older runtime you are running with?