I try to implement 2 interfaces
public class SecondScreenActivity extends Activity implements
OnCheckedChangeListener, View.OnClickListener {
but for OnCheckedChangeListener
I get this error
The type SecondScreenActivity must implement the inherited abstract method
CompoundButton.OnCheckedChangeListener.onCheckedChanged(CompoundButton, boolean)
How can I implement inherited abstract method? I never met this before...
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.
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
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.