2

2つのインターフェースを実装しようとしています

public class SecondScreenActivity extends Activity implements
OnCheckedChangeListener, View.OnClickListener {

しかし、OnCheckedChangeListener私はこのエラーが発生します

The type SecondScreenActivity must implement the inherited abstract method
CompoundButton.OnCheckedChangeListener.onCheckedChanged(CompoundButton, boolean)

継承された抽象メソッドを実装するにはどうすればよいですか? これは今まで会ったことがなかった...

4

2 に答える 2

2

You extended a class which has abstract methods ( methods without body) in order to extend this class you must implement the methods.

to implement a method you must name it the same way, with the same parameters, or click ctrl+1 on the error line in eclipse and select implement abstract methods.

于 2013-09-05T19:16:24.480 に答える
1

To implement a method add it to your class with the same signature. Here we need a method called onCheckedChange with parameters CompoundButton and boolean. So, add a method such as:

@Override
public void onCheckedChanged(CompoundButton button, boolean checked){
    //your code
}
于 2013-09-05T19:16:36.720 に答える