title: How to get text from TextView inside a CardView?
body: <p>Inside a <code>CardView</code> I have a <code>LinearLayout</code> with three <code>TextViews</code> in it and I want to get the text from these TextViews. My XML-file looks like this:</p>
  
  <pre><code> &lt;LinearLayout
          android:id="@+id/defense"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:orientation="horizontal"
          &gt;
  
          &lt;android.support.v7.widget.CardView
              android:id="@+id/cardCB"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom"
              android:layout_weight="1"
              app:cardBackgroundColor="@android:color/transparent"
              app:cardElevation="0dp"&gt;
  
            &lt;LinearLayout
                android:id="@+id/innerLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"&gt;
  
                &lt;TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:text="Rannochia"
                    android:textAlignment="center"
                    android:textStyle="bold"/&gt;
                &lt;TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:text="78"
                    android:textAlignment="center"
                    android:textStyle="bold"/&gt;
                &lt;TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:text="CB"
                    android:textAlignment="center"
                    android:textStyle="bold"/&gt;
  
            &lt;/LinearLayout&gt;
          &lt;/android.support.v7.widget.CardView&gt;
         &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Then I want to <strong>iterate</strong> through all CardViews in the parent LinearLayout and get the TextViews. Something like this:</p>
  
  <pre><code>     for (int i = 0; i &lt; defense.getChildCount(); i++){
          String getName = ((CardView)defense.getChildAt(i)).getText().toString();
          id[i] = getName;
      }
  </code></pre>
  
  <p>But I'm not able to call the methods <code>getText().toString();</code> like this. How can I get the text from these TextViews inside the CardView?</p>