TextView not Found <p>This is driving me absolutely crazy and Im not sure what is going on. I have an xml layout with a TextView within a clickable RelativeLayout. </p> <pre><code>&lt;RelativeLayout android:id="@+id/bg_section" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="10dp" android:background="@color/almost_black" android:clickable="true" android:onClick="goToBG" android:padding="10dp" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:text="Go To B.G." android:textColor="@color/white" android:textSize="20sp" /&gt; &lt;ImageView android:id="@+id/bg_arrow" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="-10dp" android:src="@drawable/arrow_icon" /&gt; &lt;TextView android:id="@+id/current_bg_count" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toLeftOf="@id/bg_arrow" android:text="3" android:textColor="@color/holo_blue" android:textSize="22sp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Now in my code I try to update the textview "current_bg_count"</p> <pre><code>private void updateBGCount(){ try{ RelativeLayout bgSection = (RelativeLayout) findViewById(R.id.bg_section); TextView bgCountTV = (TextView) bgSection.getChildAt(2); bgCountTV.setText(tempBG.size()); } catch(Exception e){ e.printStackTrace(); Logger.d(TAG, "exception in updateBGCount"); } } </code></pre> <p>This gives a ResourceNotFountException on the line where I setText although the RelativeLayout is found without a problem. Even when I try finding it just by id like this:</p> <pre><code>TextView bgCountTV = (TextView) findViewById(R.id.current_bg_count) bgCountTV.setText(tempBG.size()); </code></pre> <p>it gives the same error. All the other views in the layout are found easily and updated just fine. Only this one TextView is giving me the problem. Does anyone have any idea what the problem is?</p>