Eclipse是給了我許多錯誤的代碼的一個特定行說:我的語法有什麼問題?
在該行多個標記
- Syntax error, insert ")" to complete
ConstructorDeclaration
- Syntax error, insert "}" to complete ClassBody
- Syntax error, insert ";" to complete
ConstructorDeclaration
- Syntax error, insert ";" to complete Statement
- Syntax error, insert ")" to complete
MethodInvocation
該生產線是:
setOnClickListener(new View.OnClickListener(); {
,並在另一條線路,我得到錯誤
此行的多個標記
- Syntax error on token ")", delete
this token
- Syntax error on token "(", ; expected
for line:public void onClick(View v); {
赫雷什activity2.java:
package android.app;
import android.app.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class activity2 extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
Button next = (Button) findViewById(R.id.Back);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
Button sound = (Button) findViewById(R.id.sound);
setOnClickListener(new View.OnClickListener(); {
@Override
public void onClick(View v); {
MediaPlayer mp = MediaPlayer.create(TestSonido.this, R.raw.whippingsound);
mp.start();
}
}
;
;
}}
你想在那裏做什麼?也許你想通過改變'View.OnClickListener()來擺脫分號。 {'到'View.OnClickListener(){'你也錯過了右括號。您需要計算開合圓括號以確保它們匹配。 – 2012-01-15 02:56:47