Android Question Error: [XUI] Badger and Android 4.0.4

asales

Well-Known Member
Licensed User
Longtime User
I tried to use the "[B4X][XUI] Badger - Add badges to views"
https://www.b4x.com/android/forum/threads/b4x-xui-badger-add-badges-to-views.81723/
in Android 4.0.4 and I get this error:
B4X:
badger_v6 (java line: 108)
java.lang.NoSuchMethodError: android.view.View.setBackground
   at anywheresoftware.b4a.objects.B4XViewWrapper.SetColorAndBorder(B4XViewWrapper.java:339)
   at b4a.example3.badger.badger._v6(badger.java:108)
   at b4a.example3.badger.badger._vv4(badger.java:280)
   at b4a.example3.badger.main._button1_click(main.java:360)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
   at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
   at android.view.View.performClick(View.java:3534)
   at android.view.View$PerformClick.run(View.java:14263)
   at android.os.Handler.handleCallback(Handler.java:605)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4441)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
   at dalvik.system.NativeStart.main(Native Method)

Is possible to fix it?
If not, what the min SDK than I can use it?
Thanks in advance for any tip.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

asales

Well-Known Member
Licensed User
Longtime User
what is your min and target sdk? Should be 16+ and 22+

I think 16

https://developer.android.com/refer...ackground(android.graphics.drawable.Drawable)

Make sure to use android.jar from platform 27

Thanks @DonManfred.
My min and target SDK is: 14 and 21. The android.jar is platform 27.

I changed this code in sub CreateNewPanel and works (show the badger in a square format):
B4X:
   Dim ph As Phone
If ph.SdkVersion >= 21 Then
    xp.SetColorAndBorder(color, 0, color, radius)
Else
    xp.Color = color
End If
 
Upvote 0
Top