I have a custom navigation bar that contains a button, I would dispatch the click event so that the activity that contains my navigation bar can respond to click
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
}
can anyone help?