title: android - Getting the handle for child views from custom layout
body: <p>I have create a Java class extending <code>LinearLayout</code> as shown below</p>
  
  <pre><code>         public class CustomLinear extends LinearLayout{
  
          Context context;
  
           public CustomLinear(Context context) {
          super(context);
            this.context=context;
  
           ViewFlipper viewFlipper=new ViewFlipper(context);
           viewFlipper.setLayoutParams(this.getLayoutParams());
          this.addView(viewFlipper);
  
          }
  </code></pre>
  
  <p>And included the custom built layout into my Main.xml as shown below:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
  
  
                &lt;com.homevito.customlayout.CustomLinear
              android:id="@+id/one"
              android:layout_width="match_parent"
              android:layout_height="0dip"
              android:layout_weight="1"
              android:background="@drawable/alerts"
              android:orientation="horizontal" /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And in my MainActivity i'm using main.xml as content view as follows:</p>
  
  <pre><code>     public class MainActivity extends Activity {
  
  
  
           /** Called when the activity is first created. */
          @Override
          public void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
  
  
          }
      }
  </code></pre>
  
  <p>I want to handle the <code>viewFlipper</code> from the <code>MainActivity</code>. I tried setting Id for <code>viewFlipper</code> but still dint help...</p>
  
  <p>How can I get to handle the <code>viewflipper</code>.. 
  Thanks in advance</p>