I am just learning programming and faced with such a problem. TI need to make a switch case with the opening of activities through a fragment, but I do not know what to write for the place ruki.setOnClickListener(new View.OnClickListener()
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_home, container, false);
ImageButton ruki = v.findViewById(R.id.ruki);
ImageButton nabor = v.findViewById(R.id.nabor);
ruki.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.ruki:
Intent i = new Intent(getActivity(),ruki_activity.class);
startActivity(i);
break;
case R.id.nabor:
Intent o = new Intent(getActivity(),nabor_activity.class);
startActivity(o);
break;
}
}
});
return v;
}