Recently, the following error was reported during a jWebSocket Android client Demo:
"...... The method onAccuracyChanged (Sensor, int) of type Fundamentals must override a superclass ......"
"...... The method onClick (View) of type new View. OnClickListener () {} must override a superclass ......"
"... The method onSensorChanged (SensorEvent) of type Fundamentals must override a superclass ......"
The Code is as follows:
[Java]
LBtnSend. setOnClickListener (new OnClickListener (){
@ Override
Public void onClick (View arg0 ){
// TODO Auto-generated method stub
Try {
JWC. broadcastText ("pause ");
} Catch (WebSocketException ex ){
}
Log (lBtnSend. getText ());
If (lBtnSend. getText (). equals ("Pause ")){
LBtnSend. setText ("Begin ");
} Else {
LBtnSend. setText ("Pause ");
}
}
});
......
......
@ Override
Public void onAccuracyChanged (Sensor arg0, int arg1 ){
......
}
@ Override
Public void onSensorChanged (SensorEvent event ){
......
}
Find the jdk version.
Solution:
In Eclipse, choose Project Properties> javaCompiler and find complier compliance level to change 1.5 to 1.6. That is to say, the Java 1.5 compiler overwrites the method of the parent class by default and uses @ Override to describe it. However, 1.6 has been extended to the method of the interface, therefore, an error occurs if it is still compiled using the Java 1.5 compiler. The java compiler version is 1.6. You only need to set the compilation level to 1.6.
From column zyz316919766