You can get the id
of the View
parameter then use that in your switch
. Something like
public void onClick(View v) {
Intent n = null;
int id = v.getId();
switch (id){
case R.id.someId:
n = new Intent(getActivity(), FragMent1.class);
break;
case R.id.someOtherId:
n = new Intent(getActivity(), FragMent2.class);
break;
}
It sounds like this is what you are looking for. If not, please explain a little better what you want.
Edit
I'm not sure that I understand your latest problem but if I do then you can do something like
public void onClick(View v) {
Intent n = null;
int id = v.getId();
switch (id){
case R.id.someId:
case R.id.someOtherId:
n = new Intent(getActivity(), FragMent1.class);
break;