Android Question (B4A) [SOLVED]Error on xCustomListView v1.71

Discussion in 'Android Questions' started by zuibaf, May 15, 2019.

  1. zuibaf

    zuibaf Member Licensed User

    B4A version: v8.0
    Library: xCustomListView v.71
    Device OS: Android 2.3

    When execute the app, the error 1 ocurred. Because of this, I download of source of library for debugging:
    Using the library this error have ocurred on the line 55 of file: 'PesquisaResultadoActivity'.
    Then, I download source of library for debugging:

    Step for reproducing error:
    1) To execute the app
    2) The app is showed, click on button "Buscar Cep do Endereço".
    3) On the file 'CustomListView', Create a breakpoint in the line 226.
    4) On the app, click on button in "Buscar Cep".
    5) Wait on app searching the "cep" (cep means zip code in English)
    6) After of execute, the ide stopped on the line 226. To "step in" on this line, and next, the next line 227.
    7) The line 227 is the problem, hover the mouse, on the identifiers: "p.Color", this error is exhibited.
    8) If I not hover the mouse on the identifiers, this errors is exhibited in the a few lines next.


    Error 1:
    <!>anywheresoftware.b4a.BA 577<!> ~i:*** Service (starter) Create ***
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Service (starter) Start **
    <!>anywheresoftware.b4a.BA 577<!> Service_Start
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (main) Create, isFirst = true **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (main) Resume **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (main) Resume **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (main) Pause, UserClosed = false **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (cepdoendereco) Create, isFirst = true **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (cepdoendereco) Resume **
    <!>anywheresoftware.b4a.BA 577<!> ~i:*** Service (httputils2service) Create ***
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Service (httputils2service) Start **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (cepdoendereco) Pause, UserClosed = false **
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (pesquisaresultadoactivity) Create, isFirst = true **
    <!>anywheresoftware.b4a.BA 577<!> ~e:java.lang.NoSuchMethodError: android.graphics.drawable.ColorDrawable.getColor
    at anywheresoftware.b4a.objects.B4XViewWrapper.getColor(B4XViewWrapper.java:301)
    at b4a.example3.customlistview._insertatimpl(customlistview.java:582)
    at b4a.example3.customlistview._insertat(customlistview.java:535)
    at b4a.example3.customlistview._add(customlistview.java:71)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
    at b4a.example.pesquisaresultadoactivity.afterFirstLayout(pesquisaresultadoactivity.java:104)
    at b4a.example.pesquisaresultadoactivity.access$000(pesquisaresultadoactivity.java:17)
    at b4a.example.pesquisaresultadoactivity$WaitForLayout.run(pesquisaresultadoactivity.java:82)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3737)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:660)
    at dalvik.system.NativeStart.main(Native Method)
    <!>anywheresoftware.b4a.BA 577<!> ~i:** Activity (pesquisaresultadoactivity) Resume **
    <!>anywheresoftware.b4a.BA 577<!> ~e:An error occurred:
    (Line: 39) Dim objpn As B4XView
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    The project is quite large. Please post the relevant code.

    I recommend you to remove CustomListView, CustomListView2, HttpJob and HttpUtils2Service modules and use the libraries instead.
     
  3. zuibaf

    zuibaf Member Licensed User

    Hi,
    The only module I debugged was xCustomListView, the others I used the libraries.

    On the code below, the error have ocurred of last line of statement "for", before of "next".

    Code:
    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
        Private xui1 As XUI
       
        
    Type resultadoControle (lbCEP As Label, lbCidade As Label, lbLogradouro As Label)

    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.

        
    Private btnNovaPesquisa As Button
        
    Private lvwPesquisaResultado As CustomListView
        
    Private lbCEP As B4XView
        
    Private lbCidade As B4XView
        
    Private lbLogradouro As B4XView
        
    Private lbUF As B4XView
        
    Private lbComplemento As B4XView
    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("pesquisa_resultado_layout")
       
       
        
    ' Verifica se há ítens na lista.
        If CepDoEndereco.pesquisaResultado <> Null And CepDoEndereco.pesquisaResultado.IsInitialized Then
            
    Dim pesquisaResultado As List = CepDoEndereco.pesquisaResultado
           
            lvwPesquisaResultado.Clear
            
    For Each viaCepTipo1 As ViaCepTipo In pesquisaResultado
                
    Dim objpn As B4XView
               
                objpn = xui1.CreatePanel(
    "pnl")
                objpn.SetLayoutAnimated(
    000100%x100dip)
                objpn.LoadLayout(
    "endereco_detalhe_layout")
               
                
    Dim resultadoControle1 As resultadoControle
                resultadoControle1.Initialize
                resultadoControle1.lbCEP = lbCEP
                resultadoControle1.lbCidade = lbCidade
                resultadoControle1.lbLogradouro = lbLogradouro
               
                resultadoControle1.lbCEP.Text = viaCepTipo1.cep
                resultadoControle1.lbCidade.Text = viaCepTipo1.localidade
                resultadoControle1.lbLogradouro.Text = viaCepTipo1.logradouro

                
    ' The error ocurred on the line below.
                lvwPesquisaResultado.Add(objpn, resultadoControle1)

            
    Next
           
        
    End If
       

    End Sub
     
    Last edited: May 16, 2019
  4. zuibaf

    zuibaf Member Licensed User

    Now, I am to using library, this error continued:
    Code:
    Logger connected to: 80A358700045913517
    --------- beginning of /dev/
    log/system
    --------- beginning of /dev/
    log/main
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:*** Service (starter) Create ***
    <!>anywheresoftware.b4a.BA 
    577<!> /mnt/sdcard/Android/data/br.com.zuibaf.localiza_cep/files
    <!>anywheresoftware.b4a.BA 
    577<!> AssetsDir
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Service (starter) Start **
    <!>anywheresoftware.b4a.BA 
    577<!> Service_Start
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (main) Create, isFirst = true **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (main) Resume **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (main) Pause, UserClosed = false **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (cepdoendereco) Create, isFirst = true **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (cepdoendereco) Resume **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:*** Service (httputils2service) Create ***
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Service (httputils2service) Start **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (cepdoendereco) Pause, UserClosed = false **
    <!>anywheresoftware.b4a.BA 
    577<!> ~i:** Activity (pesquisaresultadoactivity) Create, isFirst = true **
    <!>anywheresoftware.b4a.BA 
    577<!> ~e:pesquisaresultadoactivity_activity_create (B4A line: 55)
    lvwPesquisaResultado.Add(objpn, resultadoContro
    <!>anywheresoftware.b4a.BA 
    577<!> ~e:java.lang.NoSuchMethodError: android.graphics.drawable.ColorDrawable.getColor
        at anywheresoftware.b4a.objects.B4XViewWrapper.getColor(B4XViewWrapper.java:
    375)
        at b4a.example3.customlistview._insertatimpl(customlistview.java:
    582)
        at b4a.example3.customlistview._insertat(customlistview.java:
    535)
        at b4a.example3.customlistview._add(customlistview.java:
    71)
        at br.com.zuibaf.localiza_cep.pesquisaresultadoactivity._activity_create(pesquisaresultadoactivity.java:
    440)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
    507)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    186)
        at br.com.zuibaf.localiza_cep.pesquisaresultadoactivity.afterFirstLayout(pesquisaresultadoactivity.java:
    104)
        at br.com.zuibaf.localiza_cep.pesquisaresultadoactivity.access$
    000(pesquisaresultadoactivity.java:17)
        at br.com.zuibaf.localiza_cep.pesquisaresultadoactivity$WaitForLayout.run(pesquisaresultadoactivity.java:
    82)
        at android.os.Handler.handleCallback(Handler.java:
    587)
        at android.os.Handler.dispatchMessage(Handler.java:
    92)
        at android.os.Looper.loop(Looper.java:
    130)
        at android.app.ActivityThread.main(ActivityThread.java:
    3737)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
    507)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    902)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    660)
        at dalvik.system.NativeStart.main(Native Method)
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Peter Simpson likes this.
  6. zuibaf

    zuibaf Member Licensed User

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