Android Question BubbleSeekbar example not working

Phayao

Active Member
Licensed User
Longtime User
Hello,
I'd really like to use this library - but i got these mistakes when i include the seekbar as customview in the layout:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim seek As BubbleSeekbar
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("Layout")
    ' seek.Initialize("seek")
    seek.Config(0,7,0 ,7, Colors.Yellow , Colors.RGB(0,255,239),Colors.RGB(255,255,239), Colors.RGB(99,26,0), False  ,   Colors.Transparent,18,  True , Colors.White,18,Colors.Black,18, False   ,  True ,  True,0)
    Activity.AddView(seek,0,300dip,290dip,30dip)

End Sub

the error message is:
B4X:
    ... 12 more
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 349)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at b4a.example.main._activity_create(main.java:349)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at b4a.example.main.afterFirstLayout(main.java:105)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:83)
    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:6823)

Anyone has an idea whats going on ?
Help very much appreciated,
Chris
 

DonManfred

Expert
Licensed User
Longtime User
if you load the view with loadlayout then you do not need to add it again to the activity.
Anyone has an idea whats going on ?
Upload a small project which shows the issue.

Maybe the issue is to load it with a layout. Did you tred to use it like in the example?

Edit to add: the Library is not compatible mit AndroidX. It depends on android support libs. Ask the Author to update it.
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
To add2:
the lib depends on Appcompat.
remove the dependency from the XML, add appcompat to your app. It then will work.
But even here it does not work correctly. The bubbles apears at the wrong coordinates on the screen.

Fazit: I suggest not to use the library.
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Thanks Manfred,

the example program is:
B4X:
#Region  Project Attributes 
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName: 
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #BridgeLogger: true
#End Region

#Region  Activity Attributes 
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub process_globals
    
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.
    Dim seek As BubbleSeekbar
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("Layout")
    seek.Initialize("seek")
    seek.Config(0,7,0 ,7,  Colors.Yellow , Colors.RGB(0,255,239)   ,Colors.RGB(255,255,239) ,   Colors.RGB(99,26,0), False  ,   Colors.Transparent,18, False , Colors.White,18,Colors.Black,18, False   ,  True ,  True,0)
    Activity.AddView(seek,0,300dip,290dip,30dip)

End Sub

Even with AppCompat I get the error:
B4X:
main_activity_create (java line: 349)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at b4a.example.main._activity_create(main.java:349)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at b4a.example.main.afterFirstLayout(main.java:105)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:83)
    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:6823)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)

    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 14 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;
    at com.xw.repo.BubbleSeekBar.<init>(BubbleSeekBar.java:160)
    at com.xw.repo.BubbleSeekBar.<init>(BubbleSeekBar.java:140)
    at com.xw.repo.BubbleSeekBar.<init>(BubbleSeekBar.java:136)
    at smm.bubbleseekbarlitewrapperpackage.bubbleseekbarlitewrapper._initialize(bubbleseekbarlitewrapper.java:190)
    ... 17 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.ContextCompat" on path: DexPathList[[zip file "/data/app/b4a.example-2/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-2/lib/arm, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 21 more
--------- beginning of system

During compilation it says AndroidX SDK - so probably that might be the problem.
I will look for alternatives though, thank you for helping out !

Chris
 
Upvote 0
Top