Italian "RISOLTO"errore carousel

Never99

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

    Activity.LoadLayout("splash")

    timer1.Initialize("timer1", 5000)
    timer1.Enabled = True
    myimage.Initialize(File.DirAssets, "DSCF2955.jpeg")
    splashLayout.SetBackgroundImage(myimage)
    splashLayout.Visible = True
    splashLayout.BringToFront
    
    blist.Initialize                                     'initialize an empty list
    
    bm.Initialize(File.DirAssets, "image1.jpg")
    blist.Add(bm)                                        'add the image to the list
    bm.Initialize(File.DirAssets, "image2.jpg")
    blist.Add(bm)
    
    CarouselView1.ImageBitmaps = blist                              'pass the list with images to the library

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

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub timer1_Tick
    
    splashLayout.Visible = False
    timer1.Enabled = False
    
    drawer.Initialize(Me, "Drawer", Activity, 300dip)
    drawer.CenterPanel.LoadLayout("Main")
    drawer.LeftPanel.LoadLayout("Left")

End Sub

Sub Button1_Click
    
    drawer.LeftOpen = True
    
End Sub

java.lang.NullPointerException: Attempt to invoke virtual method 'void main.java.com.synnapps.carouselview.CarouselView.setPageCount(int)' on a null object reference.
mi compare questo errore, dove sbaglio?
 

Sagenut

Expert
Licensed User
Longtime User
Sicuramente sarai su Android-X come compilazione.
La libreria non è recente, prova a fare Tools -=> Jetifier per sistemare la libreria per Android-X.
 
Top