I have one common layout that has four button at top bar and i am using this layout in all activities by including that common layout in all activities layout by
Define a header layout with 4 buttons and define android:onClick attributes inside xml layout for e.g. android:onClick="btnHomeClick"
, android:onClick="btnSearchClick"
....etc.
Define an Abstract class by extending Activity and implement all these click method:
public void btnHomeClick(View v) {
}
public void btnSearchClick(View v)
{
}
include that header layout by tag in your xml layout files. Now extends the above activity class in your every activity class.
this way you just has to define a click event for once.