1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question StrictMode policy violation [...] Landroid/graphics/drawable/GradientDrawable$GradientState

Discussion in 'Android Questions' started by FrankBerra, Jun 6, 2019.

  1. FrankBerra

    FrankBerra Active Member Licensed User

    Hello everyone.

    I never took a in consideration Google Pre-Launch reports and now while i was looking at them i saw the following error:
    Code:
    StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/graphics/drawable/GradientDrawable$GradientState;->mSolidColors:Landroid/content/res/ColorStateList;
       at android.os.StrictMode.lambda$static$
    1(StrictMode.java:428)
       at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:
    2)
       at java.lang.Class.getDeclaredField(Native Method)
       at anywheresoftware.b4a.objects.B4XViewWrapper.getColor(B4XViewWrapper.java:
    386)
       at polka.app.dotindicator._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv7(dotindicator.java:
    96)
       at polka.app.dotindicator._designercreateview(dotindicator.java:
    192)
       at java.lang.reflect.Method.invoke(Native Method)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    196)
       at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:
    67)
       at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:
    162)
       at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:
    209)
       at polka.app.main._precaricalayout_startup(main.java:
    12377)
       at polka.app.main._activity_create(main.java:
    931)
       at java.lang.reflect.Method.invoke(Native Method)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    196)
       at polka.app.main.afterFirstLayout(main.java:
    117)
       at polka.app.main.access$
    000(main.java:30)
       at polka.app.main$WaitForLayout.run(main.java:
    95)
       at android.os.Handler.handleCallback(Handler.java:
    873)
       at android.os.Handler.dispatchMessage(Handler.java:
    99)
       at android.os.Looper.loop(Looper.java:
    193)
       at android.app.ActivityThread.main(ActivityThread.java:
    6718)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:
    493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    858)
    The indicated sub is:
    Code:
    Sub AttivaUnCerchio(NumeroCerchio As Int)
       
    If NumeroCerchio <= ListaDeiCerchi.Size Then
           
    For z = 0 To ListaDeiCerchi.Size - 1
               
    Dim CerchioCheDisattivo As B4XView = ListaDeiCerchi.Get(z)
               CerchioCheDisattivo.SetColorAnimated(
    200, CerchioCheDisattivo.Color, ParametriIndicatore.Get("ColoreSfondo_Disattivo"))
           
    Next
              
           
    Dim CerchioDaAttivare As B4XView = ListaDeiCerchi.Get(NumeroCerchio - 1)
           CerchioDaAttivare.SetColorAnimated(
    200, ParametriIndicatore.Get("ColoreSfondo_Disattivo"), ParametriIndicatore.Get("ColoreSfondo_Attivo"))

       
    End If
    End Sub
    If i am not wrong, for me it seems it is related to CerchioCheDisattivo.Color.
    Anyone has an advice on how to get the color of a B4XView (in this case a panel) without violating StrictMode policy?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This is only a warning and you should ignore it. It will do no harm.
     
    FrankBerra likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice