Android Question ImageSlider problem exception divided by zero

josejad

Expert
Licensed User
Longtime User
Hi everyone:

I'm trying to use ImageSlider in my project, but when I call ImageSlider1.NextImage I get the error:

B4X:
imageslider$ResumableSub_NextImageresume (java line: 368)
java.lang.ArithmeticException: divide by zero
    at com.semi.bqa.imageslider$ResumableSub_NextImage.resume(imageslider.java:368)
    at com.semi.bqa.imageslider._nextimage(imageslider.java:342)
    at com.semi.bqa.imageslider._checktouchgesture(imageslider.java:94)
    at com.semi.bqa.imageslider._windowbase_touch(imageslider.java:607)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.BA$1.run(BA.java:325)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6119)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

In the same activity, I have a layout loaded, and I load another layout over the first one to show the pics.
I've tested in a new project just the imageslider, with the same folder and files, and it works, so the problem maybe with the two layouts?

Working project:
B4X:
Sub ImageSlider1_GetImage (Index As Int) As ResumableSub
    Return xui.LoadBitmapResize(File.DirRootExternal & "/checklist/2900040_U09/", $"1.13(${Index}).jpg"$, _
        ImageSlider1.WindowBase.Width, ImageSlider1.WindowBase.Height, True)
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
    If Permission = rp.PERMISSION_WRITE_EXTERNAL_STORAGE Then
        ImageSlider1.NumberOfImages = 3
        ImageSlider1.NextImage
      
    End If
End Sub

Failing code (in this project I've checked the PERMISSION_WRITE_EXTERNAL_STORAGE in other sub)
B4X:
Sub IVFotoPunto_Click
    ImageSlider1.NumberOfImages = 3
    Activity.LoadLayout("VisorImagenes")
    ImageSlider1.NextImage
End Sub

Sub ImageSlider1_GetImage (Index As Int) As ResumableSub
    Return xui.LoadBitmapResize(File.DirRootExternal & "/checklist/2900040_U09/", $"1.13(${Index}).jpg"$, _
        ImageSlider1.WindowBase.Width, ImageSlider1.WindowBase.Height, True)
End Sub

Thanks¡¡
 

josejad

Expert
Licensed User
Longtime User
:oops:

so simple, so obvious... sorry, blinded for too many things.

Thanks¡¡
 
Upvote 0
Top