In various activities I have very similar methods.
For example:
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.ibHome:
Intent menuIntent = new Intent(v.getContext(),Menu.class);
startActivity(menuIntent);
break;
}
}
and
@Override
public void onClick(View v) {
/** */
//
switch(v.getId()){
case R.id.bNew:
Intent newSwimmerIntent = new Intent(v.getContext(),NewSwimmer.class);
startActivity(newSwimmerIntent);
break;
case R.id.ibHome:
Intent menuIntent = new Intent(v.getContext(),Menu.class);
startActivity(menuIntent);
break;
is there a way (which I assume would be using inheritance) to prevent the menuIntent being explicitly stated in each each class?
Thanks.