Android Question AHViewpager Jar location

epiCode

Active Member
Licensed User
I've been trying to get the demo example of AHviewpager to run.
It fails to compile with following error
B4X:
Compiling generated Java code.    Error
B4A line: 70
container.Initialize
src\de\amberhome\viewpagerexample\main.java:425: error: cannot access PagerAdapter
mostCurrent._container.Initialize(mostCurrent.activityBA);
                      ^
  class file for android.support.v4.view.PagerAdapter not found

Searching the forums for error leads me to a comment by @Erel asking not to have the AHViewPager jar in libraries folder.

Someone please point me to the correct location. Thanks :)

PS: I have this line added in code:
B4X:
#AdditionalJar: com.android.support:support-v4
 

epiCode

Active Member
Licensed User
Thanks Erel,

However that did not work. If you can help me with following questions maybe it will help not just for this instance but other libraries too.

My 3rdpartylibs folder has multiple folders in it with different libraries I have saved containing Jar/xml

1. Is that ok to have subfolders in 3rdpartylibs?
2. Will B4A search for additional jars recursively ?

Jetifier tool shows "nothing to do" unless I configure the path to subfolder containing jar and not 3rdpartylibs
3. Is that normal ? or I'm missing something?

Jetifier tool after setting the path to exact folder creates two additional files ( libname.androidx.jar and jetifier.map)
4. Do we let those 2 new files stay put in that folder and set "configure path' for additional library to that folder or move these new files to basic4android\libraries folder?
5. Do we need to make a change in project like #additionaljar or it is not required
6. if yes for point 5, then do we put the original short name or libname.androidx ?

If a library depends on other library for example android-support-v4.jar or xamarin-android-support-v7
7. what would be the location of these support libraries ?
8. do we have to include #additionaljar in project declarations or the parent library (jar) will take care of it ?

That's a lot of questions but I'm sure it will help others too.
Thanks in advance
 
Upvote 0

epiCode

Active Member
Licensed User

Library Problem solved. Much Thanks
but now I'm getting a different error.

B4X:
--------- beginning of main
** Activity (main) Create, isFirst = true **
Error occurred on line: 92 (Main)
java.lang.IllegalStateException: The pager's adapter has to implement ViewPagerTabProvider.
    at de.amberhome.viewpager.internal.ViewPagerTabs.setViewPager(ViewPagerTabs.java:157)
    at de.amberhome.viewpager.AHViewPagerTabs.Initialize(AHViewPagerTabs.java:30)
    at de.amberhome.viewpagerexample.main._activity_create(main.java:472)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.viewpagerexample.main.afterFirstLayout(main.java:105)
    at de.amberhome.viewpagerexample.main.access$000(main.java:17)
    at de.amberhome.viewpagerexample.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:888)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:213)
    at android.app.ActivityThread.main(ActivityThread.java:8178)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
** Activity (main) Resume **

The code line is
B4X:
    Dim pager As AHViewPager
    Dim tabs As AHViewPagerTabs
    
    ....
    
    
    pager.Initialize("Pager")
    tabs.Initialize(pager)  << java.lang.IllegalStateException: The pager's adapter has to implement ViewPagerTabProvider.
 
Upvote 0
Top