0

I am seeking to use ViewPager 's getCurrentItem() method

I've encountered this issue before but I am not sure how to fix it. The issue was that one version of android-support-v4 revision did not have this method, and that a more updated revision had it.

On this machine though, I pulled Android Support straight through the Android SDK Manager, and this version of the android-support-v4 (rev. 7) does not have getCurrentItem() method. My project now will not compile on this machine

How can I get previous revisions of android-support-v4.jar.

tshepang
  • 12,111
  • 21
  • 91
  • 136
CQM
  • 42,592
  • 75
  • 224
  • 366

2 Answers2

3

According to the Android SDK Manager, I have the latest Android Support package, and the android-support-v4.jar contains getCurrentItem() on its ViewPager implementation, as I am using it.

The JAR I have is 271,754 bytes, dated 2012-03-21 19:02, with an md5sum of c6c2148762c614d3bad120ca01491e34.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • `The method getCurrentItem() is undefined for the type ViewPager` everything else works, `awesomePager.getCurrentItem()` – CQM Apr 02 '12 at 19:52
  • @CQM: What is the date, size, etc. of your JAR? – CommonsWare Apr 02 '12 at 19:58
  • @CQM: Are you compiling this `AwesomePager` from source? Or getting it from a JAR? If the latter, then perhaps that JAR is the thing that is out of date. – CommonsWare Apr 02 '12 at 20:08
  • I was getting it from the JAR, how do I add the v4 source to my project another way? I suppose I could add it as a package in my src, but perhaps there is a lib? or maybe I just find the ViewPager object and add that .java document – CQM Apr 02 '12 at 21:23
  • @CQM: `AwesomePager` is not part of the Android Support package. I assumed from your variable name that you are using http://code.google.com/p/viewpagerexample/source/browse/trunk/AwesomePager/ – CommonsWare Apr 02 '12 at 21:53
  • ah I believe it is related to my woes, but I was able to add the v4 source to my project and everything is fine – CQM Apr 03 '12 at 16:48
  • I still have difficulty, how would I add "getCurrentItem" to the awesomepager kind of adapter? – CQM Apr 05 '12 at 20:53
  • @CQM: `getCurrentItem()` is a method on `ViewPager`, not `PagerAdapter`. You do not need to add it to `ViewPager`, as it is already there. – CommonsWare Apr 05 '12 at 20:56
1

It looks like it should be there in the API, but... if that won't work, I think that your underlying question has been answered here.

EDIT: Well, it looks like one of the later commentators suggested "you can just use getCurrentItem()!" so I'm not sure that actually answers the underlying question at all. :(

To answer the actual question you asked, you can find support-v4 lib r6 here

Community
  • 1
  • 1
Jon O
  • 6,532
  • 1
  • 46
  • 57