Android Question Error loading carousel in project b4a

mrjaw

Active Member
Licensed User
Longtime User
someone knows how resolve this error, i'm trying to make a carousel but i got this error always.
Already i've used two libraries Of carousel and the error follow, someone can help me please?
here i attached one photo about the error and the project
 

Attachments

  • carrousel.zip
    272.6 KB · Views: 288
  • error.PNG
    error.PNG
    41.1 KB · Views: 275

Johan Schoeman

Expert
Licensed User
Longtime User
Extract the folder LibRes from attached zip file (LibRes.zip) and copy the folder and its contents to be on the same folder level as that of your B4A project's /Objects and /Files folder

Change you B4A code to this:

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
'    #Extends: android.support.v7.app.AppCompatActivity
'    #AdditionalRes: D:\Android\SDK\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region

#AdditionalRes: ..\LibRes

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private carusel As CarouselView
    Dim blist As List
    Dim bm As Bitmap
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")

    
    blist.Initialize                                     'initialize an empty list
    

'    blist.Add(bm)                                        'add the image to the list
    bm.Initialize(File.DirAssets, "Animal_Path_2.PNG.png")
    blist.Add(bm)
    bm.Initialize(File.DirAssets, "madara.jpg")
    blist.Add(bm)
    bm.Initialize(File.DirAssets, "UlquiorraCifer.png")
    blist.Add(bm)
    
    carusel.ImageBitmaps = blist                              'pass the list with images to the library

    carusel.Radius = 10                                       'the radius of the indicator circles
    carusel.StrokeColor = Colors.Magenta                      'the outline color of the circles
    carusel.StrokeWidth = 5                                   'the width of the outline circles
    carusel.FillColor = Colors.White                          'the color to fill the circles with - active page/image
    carusel.AutoPlay = True                                   'play automatically?
    carusel.CurrentItem = 0                                   'set the indeks of where to initially start from: 0 to (number of image - 1)
    carusel.DisableAutoPlayOnUserInteraction = True           'stop auto play if image is touched during autoplay
    carusel.Orientation = carusel.ORIENTATION_HORIZONTAL          'can also be ORIENTATION_VERTICAL in which case it will be position to the left of the CarouselView
    carusel.PageCount = blist.Size                            'the number of pages/images to display
    carusel.PageColor = Colors.Transparent                       'the color in the centre of the indicator circles for "not active" pages
    carusel.SlideInterval = 1000                              'the slide interval in milli seconds
      
    carusel.playCarousel

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

1.png
 

Attachments

  • LibRes.zip
    2.8 KB · Views: 305
Upvote 0
Top