title: get parent's view from a layout
body: <p>I have a <code>FragmentActivity</code> with this layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/menulabel"
      android:textSize="24sp" /&gt;
  
  &lt;EditText
      android:id="@+id/editText1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:ems="10"
      android:inputType="text"
      android:layout_below="@+id/textView1"
      android:hint="@string/search_title_hint" /&gt;
  
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/spinnersearch"
      android:layout_below="@+id/editText1" /&gt;
  
  &lt;LinearLayout
      android:id="@+id/layout1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/textView2" &gt;
  
      &lt;Spinner
          android:id="@+id/spinner_search"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:prompt="@string/spinnersearch" /&gt;
  
      &lt;Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/reset_search" /&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;Button
      android:id="@+id/button2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/buttonnewcat"
      android:layout_below="@+id/layout1" /&gt;
  
  &lt;Button
      android:id="@+id/button3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/buttondelcat" 
      android:layout_below="@+id/button2" /&gt;
  
  &lt;Button
      android:id="@+id/button4"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/buttoneditcat"
      android:layout_below="@+id/button3" /&gt;
  
  &lt;Button
      android:id="@+id/button5"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/buttonnewtext"
      android:layout_below="@+id/button4" /&gt;
  
  &lt;Button
      android:id="@+id/button6"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/buttondeltext"
      android:layout_below="@+id/button5" /&gt;
  
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;side.menu.scroll.ScrollerLinearLayout
          android:id="@+id/menu_content_side_slide_layout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="45dp"
              android:background="@drawable/ab_solid_example"
              android:orientation="horizontal" &gt;
  
              &lt;ImageView
                  android:id="@+id/main_tmp_button"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:background="@drawable/actionbar_background"
                  android:src="@drawable/download" /&gt;
  
          &lt;/LinearLayout&gt;
          &lt;FrameLayout
              android:id="@+id/fragment_container"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@drawable/bg_groud" /&gt;
  
      &lt;/side.menu.scroll.ScrollerLinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>and the ScrollerLinearLayout class is something like this:</p>
  
  <pre><code>public class ScrollerLinearLayout extends LinearLayout {
      // code of the class
  }
  </code></pre>
  
  <p>How to access from <code>ScrollerLinearLayout</code> to the parent layout to get - for example - the editetxt? <code>FragmentActivity</code> and <code>ScrollerLineraLayout</code> are in different packages of the same projects.
  I tried to use the <code>getParent()</code> function in this way within the <code>ScrollerLinearLayout</code> but it doesn't work.</p>
  
  <pre><code>RelativeLayout r = (RelativeLayout) this.getParent().getParent();
  int w = r.findViewById(R.id.editText1).getLayoutParams().width;
  </code></pre>
  
  <p>Someone help me? Thanks!</p>