I'm developing an Android app with two fragments. In one of the fragments, I have four ImageButtons and I want to add some ation to them.
So, in the Java file of that fragment I already have the code for OnClickListener but it's not working.
I'm developing an Android app with two fragments. In one of the fragments, I have four ImageButtons and I want to add some ation to them.
So, in the Java file of that fragment I already have the code for OnClickListener but it's not working.
It should be
public class GeneresFragment extends Fragment implements View.OnClickListener
The OnClickListener is a an interface
of the View class (ImageView extends View).
You have to use View.OnClickListener like this
public class felan extends Fragment implements View.OnClickListener {
Button btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
}
}