Android Question Custom List View how to Extract Edit.text Data?

Discussion in 'Android Questions' started by Condata Informatica, Jun 10, 2019.

  1. Condata Informatica

    Condata Informatica Member Licensed User

    I have this Block of code

    Code:
    Sub Find_items_customLSTview
        
    Dim i As Int 
        
    Dim iv As ItemValue= CustomListViewPRODUTOSESCALONADOS.GetValue(i)
        
    Dim qtdeItems As Int 
            
    For i=0 To  CustomListViewPRODUTOSESCALONADOS.Size -1 
            qtdeItems =    EditTextQTDECustomListView.Text
                     
            
    If qtdeItems > 0 Then
                
    Log( CustomListViewPRODUTOSESCALONADOS.GetValue(i))
               
            
    End If
        
    Next
       
    End Sub
    OBS:but the var qtdeItems always get the first value of the Index .
    OBS2: I want a way to get only the EDIT QTDE view when it is greater than 0, but I did not find a way to do this. any suggestion ?
     
  2. mangojack

    mangojack Well-Known Member Licensed User

    Firstly ... this line will always return the value of the first item ... ie: i always = 0
    Code:
    Dim i As Int
    Dim iv As ItemValue= CustomListViewPRODUTOSESCALONADOS.GetValue(i)

    if you were passing an index to the sub (to test a single value) it would make sense .. ie:
    Code:
    Sub Find_items_customLSTview(index)
        
    Dim iv As ItemValue= CustomListViewPRODUTOSESCALONADOS.GetValue(index)
    What is ItemValue ?




    try this ...
    Code:
    For i=0 To CustomListViewPRODUTOSESCALONADOS.Size -1
        
    Dim pnl As B4XView = CustomListViewPRODUTOSESCALONADOS.GetPanel(i)
        
    If pnl.GetView(0).Text > 0 Then  'view(0) = 1st edittext on panel.. refer order in Designer ViewTree for Item/Row layout
            Log"Yes " & CustomListViewPRODUTOSESCALONADOS.GetValue(i))    
        
    End If
    Next


    This is just a longer method .. but might make it clearer to you.
    Code:
    For i=0 To  CustomListViewPRODUTOSESCALONADOS.Size -1
        
    Dim pnl As B4XView = CustomListViewPRODUTOSESCALONADOS.GetPanel(i)
        
    Dim edtText As B4XView = pnl.GetView(0)
        
    If edtText.Text > 0 Then
        
    'ditto

    ps: just a suggestion .. possibly rename your CLV to clvPRODUTOSESCALONADOS
     
    Last edited: Jun 11, 2019
    Erel and Condata Informatica like this.
  3. Condata Informatica

    Condata Informatica Member Licensed User


    Thank u for this, help me much


    i got a error message whit that code , but i got this because, in the designer i got a Panel,
    wich contains anothers views,
    so to solve that
    i got

    Code:
    For i=0 To CustomListViewPRODUTOSESCALONADOS.Size -1
            
    Dim pnl As B4XView = CustomListViewPRODUTOSESCALONADOS.GetPanel(i)
            
    Dim edtText As B4XView = pnl.GetView(0).GetView(2)
            
    If edtText.Text > 0 Then
                
    Log"Yes " & CustomListViewPRODUTOSESCALONADOS.GetValue(i))
            
    End If
        
    Next
     
    mangojack likes this.
  4. mangojack

    mangojack Well-Known Member Licensed User

    Without knowing your exact Item / Row layout , I cant comment if this secondary panel is really needed .. so I will leave it here.

    Glad you got it working.
     
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