B4A Library Image Slider wrapper (daimajia.AndroidImageSlider)

Hi
This is my first experience with Library wrappers

Below is the wrapper for daimajia.AndroidImageSlider
from https://github.com/daimajia/AndroidImageSlider

687474703a2f2f7777332e73696e61696d672e636e2f6d773639302f36313064633033346a773165677a6f7236366f6a64673230393530666b6e70652e676966



simple to use, it is very simple features as well, I'll post here the source code for the wrapper in case someone wants to help enhancing the wrapper

to use the wrapper
1- Extract the "res" folder to your any path
2- Extract the "jar1.zip" and "jar2.zip" attachments to your android additional library folder
3- Add android-support-v4.jar to your android additional library folder
4- Create a new project
5- Goto the Libraries Manager and check AndroidSlider library
6- Add the line below to Project Attributes region
B4X:
#AdditionalRes: YOUR-RES-FOLDER-PATH, com.daimajia.slider.library
7- Add Slider object to the Globals sub
B4X:
Dim Slider As Slider
8- replace the Activity_create sub with the following code
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("1")
     Slider.Initialize("Slider")
   
    Activity.AddView(Slider,0dip,0dip,100%x,100%y)
'   
    Slider.AddSlide("Hannibal", "http://static2.hypable.com/wp-content/uploads/2013/12/hannibal-season-2-release-date.jpg")
    Slider.AddSlide("Big Bang Theory", "http://tvfiles.alphacoders.com/100/hdclearart-10.png")
    Slider.AddSlide("House of Cards", "http://cdn3.nflximg.net/images/3093/2043093.jpg")
    Slider.AddSlide("Game of Thrones", "http://images.boomsbeat.com/data/images/full/19640/game-of-thrones-season-4-jpg.jpg")
   
    Dim filelist As List = File.ListFiles(File.DirDefaultExternal  )
   
    For Each fi As String In filelist
        Dim path As String =File.Combine(File.DirDefaultExternal  , fi)
        If fi.LastIndexOf (".JPG")>0 Or fi.LastIndexOf (".png")>0  Then        
            Slider.AddSlide(fi , "file:" & path )
            
        End If
       
    Next
    Slider.SetTransition(Slider.SLIDER_TRANSITION_Fade)
    Slider.Delay=5000
    Slider.Start
End Sub
 

Attachments

  • jar1.zip
    400.6 KB · Views: 1,306
  • jar2.zip
    204.2 KB · Views: 1,152
  • AndroidSliderImage-SourceEclipse.zip
    93.3 KB · Views: 991
  • ImageSlideshowExample.zip
    8.8 KB · Views: 1,067
  • res.zip
    5.2 KB · Views: 1,061

Johan Schoeman

Expert
Licensed User
Longtime User
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 347)
android.view.InflateException: Binary XML file line #61: Error inflating class com.daimajia.slider.library.Tricks.InfiniteViewPager
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.daimajia.slider.library.SliderLayout.<init>(SliderLayout.java:173)
at com.daimajia.slider.library.SliderLayout.<init>(SliderLayout.java:167)
at com.daimajia.slider.library.SliderLayout.<init>(SliderLayout.java:163)
at AndroidSlider.SliderLibrary.Slider.innerInitialize(Slider.java:145)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:67)
at AndroidSlider.SliderLibrary.Slider.Initialize(Slider.java:134)
at b4a.example.main._activity_create(main.java:347)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5019)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
... 26 more
Caused by: java.lang.NoClassDefFoundError: androidx.core.view.ViewConfigurationCompat
at com.daimajia.slider.library.Tricks.ViewPagerEx.initViewPager(ViewPagerEx.java:364)
at com.daimajia.slider.library.Tricks.ViewPagerEx.<init>(ViewPagerEx.java:352)
at com.daimajia.slider.library.Tricks.InfiniteViewPager.<init>(InfiniteViewPager.java:19)
... 29 more
android.view.InflateException: Binary XML file line #61: Error inflating class com.daimajia.slider.library.Tricks.InfiniteViewPager
There is probably a layout file in the res folder that needs to be changed to allow for androidx

B4X:
Caused by: java.lang.NoClassDefFoundError: androidx.core.view.ViewConfigurationCompat
 

Argencom

New Member
Licensed User
Longtime User
Good night, the library works well for me in emulator, however the phone does not load the images, could you help me with that?

Thank you very much
 

Argencom

New Member
Licensed User
Longtime User
Good night, the library works well for me in emulator, however the phone does not load the images, could you help me with that?

Thank you very much

any ideas on this?

could it be due to the picasso bookstore? My phone has android 10, in the emulator it works correctly
 
Top