title: How to dispatch click event in Android
body: <p>I have a custom navigation bar that contains a button, I would dispatch the click event so that the activity that contains my <em>navigation</em> bar can respond to <em>click</em></p>
  
  <pre><code>    public class BarrePersonnalisee extends LinearLayout implements OnClickListener {
          Context mycontext;
          View convertview;
          ImageButton searchadresse;
  
          public BarrePersonnalisee(Context context, AttributeSet attrs) {
              super(context, attrs);
              mycontext=context;
              convertview=LayoutInflater.from(mycontext).inflate(R.layout.barre, this);
              searchadresse=(ImageButton)convertview.findViewById(R.id.searchadresse);
              searchadresse.setOnClickListener(this);
          }
  
          public void onClick(View arg0) {
              switch (arg0.getId()) {
              case R.id.searchadresse:
                  //I want to dispatch this event
                      break;
                     }
              }
      ....
      }
  
  public class TaxiMapActivity extends MapActivity{
  
      BarrePersonnalisee barre;
  
      ...
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          barre=(BarrePersonnalisee)this.findViewById(R.id.barre1);
          //task to do here
  
  
  }
  </code></pre>
  
  <p>can anyone help?</p>