title: How can I fire Onclick event programmatically?
body: <p>I have a custom view with 2 linear layouts: the first is the view's header and the second is the the details view.</p>
  
  <p>In the custom view, the OnClickListener of the header Linearlayout is already defined: when it fires, it collapses/expandes the second linearlayout.</p>
  
  <p>What I want to do is to add more functionalities to my header's OnClickListener event (i.e.: collapse/expand the second layout and show a Toast).</p>
  
  <p>I can't modify the source code of the custom view. I tried to set a new OnClickListener but it hides the initial event (collapse/expand).</p>
  
  <p>How should I implement this?</p>
  
  <p>The source code of My Custom View:</p>
  
  <pre><code>public class ExpandoLayout extends ViewGroup
  {
      /* some declarations */
      private Linearlayout header;
      private linearlayout footer;
  
      /* some code */
      @override
      protected void onFinishInflate() {
      header= new LinearLayout(context);
      header.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  toggleExpand();
              }
          });
      }
  }
  </code></pre>
  
  <p>What I want to do is to add some code to the already defined OnClickListener event in my activity.
  Something like that:</p>
  
  <pre><code>public class myActivity extends Activity {
  private Linearlayout myCustomView;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.rsdetail);
      myCustomView= (MyCustomView) findViewById(R.id.expanded);
  
      myCustomView.getChildAt(0).setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              if(v instanceof LinearLayout)
              {
                  v.performClick();
  
                  Toast.makeText(getActivity(), "ExpandoOnClickListener", 2000).show();
              }
          }
      });
  }
  </code></pre>