Android Question How to extract Label and Edit controls from AppCompact containers?

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hello to all
I'm trying to implement the locator for my app (https://www.b4x.com/android/forum/t...localize-your-b4x-applications.68751/#content)

I state that I use the controls of the Material Design library.

In the LocalizeLayout function

B4X:
Public Sub LocalizeLayout(PanelOrActivity As Panel)
   
    Dim aNumViews As Int
           
    For Each v As View In PanelOrActivity.GetAllViewsRecursive
       
        aNumViews    =    aNumViews + 1
       
        Log($"Type Of control "${GetType(v)}"$)
                       
        If v Is Label Then 'this will catch all of Label subclasses which includes EditText, Button and others
            Dim lbl As Label = v
            lbl.Text = Localize(lbl.Text)
        End If
       
        If v Is EditText Then
            Dim et As EditText = v
            et.Hint = Localize(et.Hint)
        End If
       
       
       
    Next
   
   
    Log($"Number of controls ${aNumViews} "$)
   
End Sub

Only these controls are displayed:

Type Of control "android.support.v7.widget.Toolbar
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "android.support.v7.widget.AppCompatImageButton
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "android.support.design.widget.TabLayout
Type Of control "android.support.design.widget.TabLayout$SlidingTabStrip
Type Of control "android.support.design.widget.TabLayout$TabView
Type Of control "android.support.v7.widget.AppCompatImageView
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "android.support.design.widget.TabLayout$TabView
Type Of control "android.support.v7.widget.AppCompatImageView
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "android.support.design.widget.TabLayout$TabView
Type Of control "android.support.v7.widget.AppCompatImageView
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "android.support.design.widget.TabLayout$TabView
Type Of control "android.support.v7.widget.AppCompatImageView
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "android.support.design.widget.TabLayout$TabView
Type Of control "android.support.v7.widget.AppCompatImageView
Type Of control "android.support.v7.widget.AppCompatTextView
Type Of control "de.amberhome.viewpager.internal.CustomViewPager


how can I dynamically read all the label and edit controls that are inside
to these?

thank
 
Top